From 569aacd7ad3bb16fe6faf457dde38b4aa25a9e9c Mon Sep 17 00:00:00 2001 From: Luke Curley <432854+kixelated@users.noreply.github.com> Date: Fri, 16 Oct 2026 20:19:39 -0700 Subject: [PATCH 1/8] quest(m2): claim dart-codecs Co-Authored-By: Claude Opus 5.5 From ad81e410cea4cac771c969c569369ea4ab921fdd Mon Sep 17 00:00:00 2001 From: Luke Curley <432854+kixelated@users.noreply.github.com> Date: Fri, 16 Oct 2026 20:37:32 -0700 Subject: [PATCH 2/8] feat(dart): ship codecs and expose audio and video namespaces The Dart libraries now build moq-ffi with its default features, like the Kotlin and Swift ones, so `package:moq/video.dart` and `package:moq/audio.dart` expose the native encoders, producers, and decoding consumers. A Dart test decodes a subscribed H.264 rendition. Co-Authored-By: Claude Opus 5.5 --- .github/ffi.md | 3 +- .github/workflows/release-dart-ffi.yml | 1 - .github/workflows/release-ffi.yml | 15 +--- dart/README.md | 2 +- dart/moq/lib/audio.dart | 63 +++++++++++++ dart/moq/lib/video.dart | 90 +++++++++++++++++++ dart/moq/test/docs/prelude.dart | 2 + dart/moq/test/moq_test.dart | 107 +++++++++++++++++++++++ dart/moq_ffi/README.md | 4 +- dart/moq_ffi/hook/build.dart | 1 - dart/moq_ffi/lib/src/uniffi_runtime.dart | 2 + doc/lib/dart/index.md | 48 +++++++++- doc/lib/index.md | 4 +- quest/m2/README.md | 1 - quest/m2/dart-codecs.md | 38 -------- quest/m2/mobile-completion.md | 1 - sh/dart/generate.sh | 2 +- sh/gh/ffi.test.ts | 1 - 18 files changed, 318 insertions(+), 67 deletions(-) create mode 100644 dart/moq/lib/audio.dart create mode 100644 dart/moq/lib/video.dart delete mode 100644 quest/m2/dart-codecs.md diff --git a/.github/ffi.md b/.github/ffi.md index de22438b1ec..f8cfb1ffef0 100644 --- a/.github/ffi.md +++ b/.github/ffi.md @@ -3,7 +3,8 @@ `release-shared-ffi.yml` owns the existing `moq-ffi-v*` tag trigger for Go, Kotlin and Swift. Nightly calls the same coordinator without publisher secrets. It builds nine distinct default-feature targets, replacing fourteen native -builds across those packages. Dart retains its eleven minimal-feature targets; +builds across those packages. Dart retains its own eleven default-feature +targets, a superset that adds `x86_64-apple-darwin` and `x86_64-apple-ios`; Python retains its wheel builds and Python-specific environment. C++ retains source builds as its default and independent `cpp-v*` release tags. diff --git a/.github/workflows/release-dart-ffi.yml b/.github/workflows/release-dart-ffi.yml index 444e0af27ee..c1f7d46c30a 100644 --- a/.github/workflows/release-dart-ffi.yml +++ b/.github/workflows/release-dart-ffi.yml @@ -43,7 +43,6 @@ jobs: language: dart # The raw bindings are checked in under dart/moq_ffi, so none here. bindings: false - default-features: false # Full platform packaging remains nightly; PRs keep only Linux/Android. targets: ${{ github.event_name == 'pull_request' && github.base_ref != 'release' && '["aarch64-linux-android", "armv7-linux-androideabi", "x86_64-linux-android", "x86_64-unknown-linux-gnu", "aarch64-unknown-linux-gnu"]' || '["aarch64-linux-android", "armv7-linux-androideabi", "x86_64-linux-android", "x86_64-unknown-linux-gnu", "aarch64-unknown-linux-gnu", "aarch64-apple-darwin", "x86_64-apple-darwin", "aarch64-apple-ios", "aarch64-apple-ios-sim", "x86_64-apple-ios", "x86_64-pc-windows-msvc"]' }} diff --git a/.github/workflows/release-ffi.yml b/.github/workflows/release-ffi.yml index 44937e13f23..ee5fdba7d9b 100644 --- a/.github/workflows/release-ffi.yml +++ b/.github/workflows/release-ffi.yml @@ -19,10 +19,6 @@ on: description: "Generate and upload the bindings for `language`" type: boolean default: true - default-features: - description: "Build moq-ffi with its default features (audio and video)" - type: boolean - default: true reuse-native: description: "Consume the coordinator's native libraries and bindings" type: boolean @@ -109,15 +105,10 @@ jobs: env: BUILD_TARGET: ${{ matrix.target }} BUILD_VERSION: ${{ needs.parse-version.outputs.version }} - DEFAULT_FEATURES: ${{ inputs.default-features }} # Set iOS deployment target to avoid ___chkstk_darwin linker errors. IPHONEOS_DEPLOYMENT_TARGET: ${{ contains(matrix.target, 'apple-ios') && '16.0' || '' }} run: | - args=(--target "$BUILD_TARGET" --version "$BUILD_VERSION" --output dist) - if [[ "$DEFAULT_FEATURES" == false ]]; then - args+=(--no-default-features) - fi - just rs package-ffi "${args[@]}" + just rs package-ffi --target "$BUILD_TARGET" --version "$BUILD_VERSION" --output dist - name: Upload lib uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 @@ -175,15 +166,11 @@ jobs: env: BUILD_VERSION: ${{ needs.parse-version.outputs.version }} REUSE_LIBRARY: ${{ contains(fromJSON(inputs.targets), 'x86_64-unknown-linux-gnu') }} - DEFAULT_FEATURES: ${{ inputs.default-features }} run: | args=(--bindings-only --version "$BUILD_VERSION" --output dist) if [[ "$REUSE_LIBRARY" == true ]]; then args+=(--library binding-library/libmoq_ffi.so) fi - if [[ "$DEFAULT_FEATURES" == false ]]; then - args+=(--no-default-features) - fi just rs package-ffi "${args[@]}" - name: Upload bindings diff --git a/dart/README.md b/dart/README.md index ec9a959cb25..4693010a517 100644 --- a/dart/README.md +++ b/dart/README.md @@ -6,7 +6,7 @@ This directory contains two packages: - `moq` is the independently-versioned ergonomic API applications should use. Run `just dart check` from the repository root. The check rebuilds -`moq-ffi` without optional codec features, verifies the generated source, +`moq-ffi` with its default codec features, verifies the generated source, analyzes and tests both packages, and validates their publish layout. `dart test` drives the Native Assets hook, so the round-trip tests in diff --git a/dart/moq/lib/audio.dart b/dart/moq/lib/audio.dart new file mode 100644 index 00000000000..af57b20d77b --- /dev/null +++ b/dart/moq/lib/audio.dart @@ -0,0 +1,63 @@ +/// Native audio encoding, publication, and decoding. +/// +/// Import it with a prefix, since `Frame` and `Codec` mean something else in +/// the other libraries: +/// +/// ```dart +/// import 'package:moq/audio.dart' as audio; +/// ``` +library; + +import 'package:moq_ffi/moq_ffi.dart'; + +/// Encodes PCM and publishes it as a track; construct it from the broadcast's `CatalogProducer`. +typedef Producer = MoqAudioProducer; + +/// Encodes PCM without publishing it. +typedef Encoder = MoqAudioEncoder; + +/// Subscribes to a catalog audio rendition and yields decoded PCM; open one with `Consumer.subscribe`. +typedef Consumer = MoqAudioConsumer; + +/// The PCM layout written to a [Producer]. +typedef EncoderInput = MoqAudioEncoderInput; + +/// The codec side: codec, track name, rate, channels, bitrate, and frame duration (0 takes the codec's own frame). +typedef EncoderOutput = MoqAudioEncoderOutput; + +/// The PCM layout a [Consumer] delivers and how stale a group may get. +typedef DecoderOutput = MoqAudioDecoderOutput; + +/// Interleaved PCM with its presentation timestamp. +typedef Frame = MoqAudioFrame; + +/// One encoded payload from an [Encoder]. +typedef Packet = MoqAudioPacket; + +/// The packets an [Encoder] drains on finish and the padded samples to discard. +typedef EncoderFinish = MoqAudioEncoderFinish; + +/// The audio codec: `Codec.opus()` or `Codec.aac()`. +typedef Codec = MoqAudioCodec; + +/// A raw PCM sample layout. +typedef SampleFormat = MoqAudioSampleFormat; + +/// Duration view over a PCM frame's timestamp. +extension AudioFrameDuration on MoqAudioFrame { + /// Presentation timestamp of the first sample. + Duration get timestamp => Duration(microseconds: timestampUs); +} + +/// Duration view over an encoder's frame size. +extension AudioEncoderOutputDuration on MoqAudioEncoderOutput { + /// Encoded frame duration; zero takes the codec's own. + Duration get frameDuration => Duration(microseconds: frameDurationUs); +} + +/// Duration view over a decoder's latency bound. +extension AudioDecoderOutputDuration on MoqAudioDecoderOutput { + /// Upper bound on buffering before a stalled group is skipped, or null for the default. + Duration? get maxDelay => + maxDelayUs == null ? null : Duration(microseconds: maxDelayUs!); +} diff --git a/dart/moq/lib/video.dart b/dart/moq/lib/video.dart new file mode 100644 index 00000000000..50e29593457 --- /dev/null +++ b/dart/moq/lib/video.dart @@ -0,0 +1,90 @@ +/// Native video encoding, publication, and decoding. +/// +/// Import it with a prefix, since `Frame` and `Codec` mean something else in +/// the other libraries: +/// +/// ```dart +/// import 'package:moq/video.dart' as video; +/// ``` +library; + +import 'package:moq_ffi/moq_ffi.dart'; + +/// Encodes raw pictures and publishes them as a track; construct it from the broadcast's `CatalogProducer`. +typedef Producer = MoqVideoProducer; + +/// Encodes raw pictures without publishing them. +typedef Encoder = MoqVideoEncoder; + +/// Subscribes to a catalog video rendition and yields decoded frames; open one with `Consumer.subscribe`. +typedef Consumer = MoqVideoConsumer; + +/// The pixel layout, resolution, and framerate written to a [Producer]. +typedef EncoderInput = MoqVideoEncoderInput; + +/// The track name, codec, bitrate, group mode, and backend preference. +typedef EncoderOutput = MoqVideoEncoderOutput; + +/// What a [Consumer] delivers: an optional resize, a max delay, and whether to keep the decoder's surface (macOS and iOS). +typedef DecoderOutput = MoqVideoDecoderOutput; + +/// One raw picture with its presentation timestamp. +typedef Frame = MoqVideoFrame; + +/// A decoded picture from a [Consumer]; `dispose()` it promptly, since held frames stall the decoder. +typedef DecodedFrame = MoqVideoDecodedFrame; + +/// The platform image backing a [DecodedFrame], when [DecoderOutput] asked for one. +typedef Surface = MoqVideoSurface; + +/// A borrowed `CVPixelBufferRef` address (macOS and iOS), valid while its [DecodedFrame] lives. +typedef PixelBuffer = PixelBufferMoqVideoSurface; + +/// One encoded access unit from an [Encoder]. +typedef Packet = MoqVideoPacket; + +/// How pictures are split into independently decodable groups. +typedef Gop = MoqVideoGop; + +/// A keyframe every `interval` pictures. +typedef Keyframe = KeyframeMoqVideoGop; + +/// H.264 or H.265. +typedef Codec = MoqVideoCodec; + +/// A CPU pixel layout (I420 or RGBA). +typedef PixelFormat = MoqVideoPixelFormat; + +/// The encoder backend preference. +typedef EncoderKind = MoqVideoEncoderKind; + +/// Prefer a platform hardware encoder, falling back to software. +typedef AutoEncoder = AutoMoqVideoEncoderKind; + +/// Hardware only; fails if none is available. +typedef HardwareEncoder = HardwareMoqVideoEncoderKind; + +/// Software only (openh264, H.264 only). +typedef SoftwareEncoder = SoftwareMoqVideoEncoderKind; + +/// A specific backend by name, such as `videotoolbox`, `mediafoundation`, or `openh264`. +typedef NamedEncoder = NamedMoqVideoEncoderKind; + +/// Duration view over a raw picture's timestamp. +extension VideoFrameDuration on MoqVideoFrame { + /// Presentation timestamp. + Duration get timestamp => Duration(microseconds: timestampUs); +} + +/// Duration view over a decoded picture's timestamp. +extension VideoDecodedFrameDuration on MoqVideoDecodedFrame { + /// Presentation timestamp. + Duration get timestamp => Duration(microseconds: timestampUs()); +} + +/// Duration view over a decoder's latency bound. +extension VideoDecoderOutputDuration on MoqVideoDecoderOutput { + /// Upper bound on buffering before a stalled group is skipped, or null for the default. + Duration? get maxDelay => + maxDelayUs == null ? null : Duration(microseconds: maxDelayUs!); +} diff --git a/dart/moq/test/docs/prelude.dart b/dart/moq/test/docs/prelude.dart index d4e967d0505..02c1f7b750b 100644 --- a/dart/moq/test/docs/prelude.dart +++ b/dart/moq/test/docs/prelude.dart @@ -5,3 +5,5 @@ import 'package:moq/moq.dart'; Moq get moq => throw UnimplementedError(); Uint8List get bytes => throw UnimplementedError(); +Uint8List get rgba => throw UnimplementedError(); +int get pts => throw UnimplementedError(); diff --git a/dart/moq/test/moq_test.dart b/dart/moq/test/moq_test.dart index 8793cfc4d29..78265e27ff0 100644 --- a/dart/moq/test/moq_test.dart +++ b/dart/moq/test/moq_test.dart @@ -1,10 +1,12 @@ import 'dart:convert'; import 'dart:typed_data'; +import 'package:moq/audio.dart' as moq_audio; import 'package:moq/media.dart' as moq_media; import 'package:moq/flate.dart' as moq_flate; import 'package:moq/json.dart' as moq_json; import 'package:moq/moq.dart'; +import 'package:moq/video.dart' as moq_video; import 'package:test/test.dart'; const timeout = Duration(seconds: 10); @@ -281,6 +283,22 @@ void main() { Frame(payload: Uint8List(0), timestampUs: 20000).timestamp, const Duration(milliseconds: 20), ); + expect( + moq_video.Frame(timestampUs: 33333, data: Uint8List(0)).timestamp, + const Duration(microseconds: 33333), + ); + expect(moq_video.DecoderOutput().maxDelay, isNull); + expect( + moq_audio.EncoderOutput(codec: moq_audio.Codec.opus()).frameDuration, + Duration.zero, + ); + expect( + moq_audio.DecoderOutput( + format: moq_audio.SampleFormat.f32, + maxDelayUs: 500, + ).maxDelay, + const Duration(microseconds: 500), + ); }); test('a broadcast is reachable only while announced', () async { @@ -390,4 +408,93 @@ void main() { producer.finish(); broadcast.close(); }); + + test('decoded video frame owns its picture', () async { + final broadcast = BroadcastProducer(); + final video = moq_video.Producer( + catalog: moq_media.CatalogProducer(broadcast: broadcast), + input: moq_video.EncoderInput( + format: moq_video.PixelFormat.rgba, + width: 320, + height: 240, + framerate: 30, + ), + // Software so the encode is deterministic everywhere. + output: moq_video.EncoderOutput( + codec: moq_video.Codec.h264, + track: 'camera', + kind: moq_video.SoftwareEncoder(), + ), + ); + + // Seed the track so a subscriber joining below lands on encoded media. + final rgba = Uint8List(320 * 240 * 4)..fillRange(0, 320 * 240 * 4, 0x80); + video.cut(); + for (var i = 0; i < 10; i++) { + video.write( + frame: moq_video.Frame(timestampUs: i * 33333, data: rgba), + ); + } + + final consumer = broadcast.consume(); + final catalogs = await moq_media.CatalogConsumer.subscribe( + broadcast: consumer, + ).timeout(timeout); + final catalog = await catalogs.next().timeout(timeout); + final decoder = await moq_video.Consumer.subscribe( + broadcast: consumer, + name: 'camera', + catalogVideo: catalog!.video['camera']!, + output: moq_video.DecoderOutput(), + ).timeout(timeout); + + // Keep the encoder fed so the decoder sees frames after it joined. + for (var i = 10; i < 40; i++) { + video.write( + frame: moq_video.Frame(timestampUs: i * 33333, data: rgba), + ); + } + + final frame = await decoder.next().timeout(timeout); + // The frame outlives its consumer's cancellation. + decoder.cancel(); + final pixels = frame!.width() * frame.height(); + expect( + frame.pixels(format: moq_video.PixelFormat.i420).length, + pixels * 3 ~/ 2, + ); + final packed = frame.pixels(format: moq_video.PixelFormat.rgba); + expect(packed.length, pixels * 4); + for (var i = 3; i < packed.length; i += 4) { + expect(packed[i], 0xFF); + } + expect(frame.surface(), isNull); + frame.dispose(); + + video.finish(); + catalogs.cancel(); + broadcast.close(); + }); + + test('audio producer encodes opus', () { + final broadcast = BroadcastProducer(); + final producer = moq_audio.Producer( + catalog: moq_media.CatalogProducer(broadcast: broadcast), + input: moq_audio.EncoderInput( + format: moq_audio.SampleFormat.f32, + sampleRate: 48000, + channels: 1, + ), + output: moq_audio.EncoderOutput( + codec: moq_audio.Codec.opus(), + track: 'mic', + ), + ); + producer.write( + frame: moq_audio.Frame(timestampUs: 0, data: Uint8List(960 * 4)), + ); + expect(producer.demand().name(), 'mic'); + producer.finish(); + broadcast.close(); + }); } diff --git a/dart/moq_ffi/README.md b/dart/moq_ffi/README.md index ce0d2d4cf96..682a9fe893d 100644 --- a/dart/moq_ffi/README.md +++ b/dart/moq_ffi/README.md @@ -21,6 +21,6 @@ The path is resolved relative to the `pubspec.yaml` that declares it. This is the only override: build hooks run with a filtered environment, so an environment variable cannot reach one. -The first release excludes the optional native audio and video codec features. -It provides the complete data-plane API, including sessions, announcements, +The native libraries carry moq-ffi's default features, so the native audio +and video encoders and decoders ship alongside sessions, announcements, broadcasts, tracks, groups, frames, catalogs, and JSON tracks. diff --git a/dart/moq_ffi/hook/build.dart b/dart/moq_ffi/hook/build.dart index bfb465d6036..9f50115518d 100644 --- a/dart/moq_ffi/hook/build.dart +++ b/dart/moq_ffi/hook/build.dart @@ -94,7 +94,6 @@ Future<_Resolved> _build(Uri workspace, String target, String library) async { '--release', '--package', 'moq-ffi', - '--no-default-features', '--manifest-path', workspace.resolve('Cargo.toml').toFilePath(), ]; diff --git a/dart/moq_ffi/lib/src/uniffi_runtime.dart b/dart/moq_ffi/lib/src/uniffi_runtime.dart index ab87a64ed3f..1eefdf6293d 100644 --- a/dart/moq_ffi/lib/src/uniffi_runtime.dart +++ b/dart/moq_ffi/lib/src/uniffi_runtime.dart @@ -8,6 +8,7 @@ import "dart:ffi"; import "dart:io" show Platform, File, Directory; import "dart:isolate"; import "dart:typed_data"; + import "package:ffi/ffi.dart"; class UniffiInternalError implements Exception { @@ -247,6 +248,7 @@ mixin FfiConverterPrimitive on FfiConverter { @override T lower(T value) => value; } + Uint8List createUint8ListFromInt(int value) { int length = value.bitLength ~/ 8 + 1; if (length != 4 && length != 8) { diff --git a/doc/lib/dart/index.md b/doc/lib/dart/index.md index 26f21788294..ac462c9d470 100644 --- a/doc/lib/dart/index.md +++ b/doc/lib/dart/index.md @@ -32,6 +32,9 @@ construct the read side from a broadcast; the last two take a catalog `media.Ren follow its broadcast and track themselves. For arrival-order reads, decode each group from `TrackConsumer.recvGroup()` with `media.GroupConsumer(group: ..., container: ...)`; frames carry container media time as they land. +`package:moq/video.dart` and `package:moq/audio.dart` encode raw pixels and PCM inside the +binding: `video.Producer` / `audio.Producer` take a `CatalogProducer`, and +`video.Consumer.subscribe` / `audio.Consumer.subscribe` decode a catalog rendition. ```bash dart pub add moq # or: flutter pub add moq @@ -65,7 +68,48 @@ print(await catalog.next()); ``` ```dart -// Publish. bytes comes from your encoder or application source. +// Publish raw pixels; the binding encodes them. rgba and pts come from your capture source. +import 'package:moq/video.dart' as video; + +final camera = moq.createBroadcast('live/camera'); +final encoder = video.Producer( + catalog: media.CatalogProducer(broadcast: camera), + input: video.EncoderInput( + format: video.PixelFormat.rgba, + width: 1280, + height: 720, + framerate: 30, + ), + output: video.EncoderOutput( + codec: video.Codec.h264, + track: 'camera', + kind: video.AutoEncoder(), + ), +); +encoder.write(frame: video.Frame(timestampUs: pts, data: rgba)); +camera.announce(route: MoqRoute(epoch: mintEpoch())); +encoder.finish(); +``` + +```dart +// Decode a subscribed rendition. Dispose each frame promptly. +import 'package:moq/video.dart' as video; + +final remote = await moq.requestBroadcast('live/camera'); +final renditions = await media.CatalogConsumer.subscribe(broadcast: remote); +final decoder = await video.Consumer.subscribe( + broadcast: remote, + name: 'camera', + catalogVideo: (await renditions.next())!.video['camera']!, + output: video.DecoderOutput(), +); +final frame = (await decoder.next())!; +print(frame.pixels(format: video.PixelFormat.rgba).length); +frame.dispose(); +``` + +```dart +// Publish already-encoded frames. bytes comes from your encoder or application source. final mine = moq.createBroadcast('live/camera'); final track = mine.publishTrack(name: 'video', info: null); final group = track.appendGroup(); @@ -84,10 +128,10 @@ The rest of the [shared feature list](/lib/#what-every-binding-can-do) maps one to one; the API reference has the names, and [Layers](/lib/layers) shows which module holds each. -- **No codecs.** Unlike the other bindings, the published Dart binaries carry no encoder or decoder. Already-encoded frames flow through `media.TrackProducer` and `media.TrackConsumer`; encoding is up to `package:camera`, platform channels, or another codec package. - **Names.** Types drop the `Moq` prefix (`Session`, `BroadcastProducer`) as aliases, so the generated names still work. `Container`, `Route`, and the exceptions keep it, since Flutter owns those names. `dynamic` is reserved, so the origin method is `dynamic_`. - **Audio needs cuts.** Video groups at its keyframes, but audio forms a group only where you call `cut()`: after every frame, or at a segment cadence to align with video. - **Live encoder timing.** After writing a frame you encoded yourself, call `flush(timestampUs: ...)` with the same timestamp so the catalog advertises your jitter. Skip it for file and network imports. On a seek or pause, call `discontinuity()`, then keep timestamps moving forward and resume video on a keyframe. +- **Decoded frames hold decoder buffers.** `dispose()` each frame from a `video.Consumer` promptly rather than waiting for the garbage collector, or the decoder stalls. `resize` is best effort, so read each frame's `width()` and `height()`. - **Closing.** `await moq.close()` or `session.shutdown()` drains for up to one second and reports any error. `session.cancel(code: 0)` closes at once. Finish or abort live tracks first. Cancelling a stream subscription releases its native cursor. Application delivery requires explicitly selecting `moq-lite-07-wip` on both peers; older Lite versions (including default lite-06) and IETF wait only for transport ACKs. - **Stats.** `session.stats()` reports `rttUs`, `estimatedSendRateBps`, `estimatedRecvRateBps`, and the byte and packet counters (`bytesSent`, `bytesReceived`, `bytesLost`, `packetsSent`, `packetsReceived`, `packetsLost`). A field is `null` when the transport does not report it, which is not the same as zero. - **Errors.** Read diagnostic payloads from `reason` and structured protocol failures from `details`. diff --git a/doc/lib/index.md b/doc/lib/index.md index da0c27fbc50..71a5a434fd6 100644 --- a/doc/lib/index.md +++ b/doc/lib/index.md @@ -46,6 +46,4 @@ how it looks in that language: - **Routes**: see which relays a broadcast came through, and advertise a cost as a standby publisher. - **Connection stats** and **errors** that tell an auth rejection (don't retry) from a shutdown or a transport failure. -Dart is the exception on codecs: its published binaries carry no encoder or -decoder, so it moves already-encoded frames. C's audio decoder neither takes -nor reports a playout delay. +C's audio decoder neither takes nor reports a playout delay. diff --git a/quest/m2/README.md b/quest/m2/README.md index b366e6e2d82..a25d1cbdba8 100644 --- a/quest/m2/README.md +++ b/quest/m2/README.md @@ -82,7 +82,6 @@ ranked just below deterministic TS legs, which it requires. - [Go module proxy](/quest/m2/go-module-proxy.md) - `moq.dev/moq-ffi` ships from a static GOPROXY we host, so its staticlibs stop growing git history by ~61 MiB per release - [Go per-platform lib modules](/quest/m2/go-ffi-platform-modules.md) - a Go build downloads only the host's staticlib, and `go mod vendor` works - [Dart on iOS](/quest/m2/dart-ios.md) - prove the shipped iOS native asset actually loads on a device, which no CI can -- [Dart codec parity](/quest/m2/dart-codecs.md) - Dart is the one binding that cannot originate media - [Mobile completion](/quest/m2/mobile-completion.md) - verify the Swift and Kotlin bindings over Rust-owned capture before closing #700 - [Catalog colour](/quest/m2/color-catalog.md) - the catalog describes a rendition's colour and HDR properties, which the WebGPU HDR renderer reads - [Display aspect](/quest/m2/display-aspect.md) - H.264 and H.265 (Annex-B and hvcC) importers report a non-square sample aspect as the catalog display aspect, and AV1 too if it carries one diff --git a/quest/m2/dart-codecs.md b/quest/m2/dart-codecs.md deleted file mode 100644 index 5ebb01ef675..00000000000 --- a/quest/m2/dart-codecs.md +++ /dev/null @@ -1,38 +0,0 @@ -# [M] Dart codec parity - -## Goal - -A Dart application can capture and encode, like a Swift or Kotlin one. Today -the Dart libraries are built `--no-default-features`, so they carry no `audio` -or `video`: no `MoqAudioProducer`, no `MoqVideoProducer`, and no encoder or -decoder anywhere. - -## Plan - -Catalog and container types are present, so an application can carry -already-encoded frames and nothing is broken. It is the one binding that -cannot originate media, which makes it the odd one out rather than the lean -one. - -There is no cross-compilation reason for the difference, which is what makes -this worth closing rather than documenting: `release-shared-ffi.yml` already -builds the same Android, desktop and iOS targets with default features for -Kotlin and Swift. The cost is real but known: -`audio` and `video` pull roughly forty crates plus openh264's vendored C++, -which is why Dart shipped without them first. - -Build the release artifacts with defaults, check the size and build-time cost -against the Kotlin and Swift artifacts that already pay it, and update -`/doc/lib/dart`, which currently documents the omission. - -Deployment floors stay as they are (Android API 24, iOS 16); a codec addition -that raises either is a separate decision. - -This quest owns Dart integration of the already-landed `MoqVideoConsumer` and -`MoqAudioConsumer` (including its playout `delay_us`): expose them through the -Dart wrapper, ship codec-enabled artifacts, and test -subscribed video decoding from Dart in CI. Update the capability docs in the -same change. Do not finish with codecs enabled but the consumer unexposed. - -Decided in the 2026-09-30 audit: wait for the codec namespaces, so the Dart -wrapper exposes encoders and decoders in their final shape once. diff --git a/quest/m2/mobile-completion.md b/quest/m2/mobile-completion.md index de36a8ee3c1..c52463d29b0 100644 --- a/quest/m2/mobile-completion.md +++ b/quest/m2/mobile-completion.md @@ -26,7 +26,6 @@ quests. ## Required - [Dart on iOS](/quest/m2/dart-ios.md) - the Dart iOS asset proof -- [Dart codec parity](/quest/m2/dart-codecs.md) - codec-enabled artifacts and Dart video consumer integration - [iOS capture](/quest/m2/mobile-capture-ios.md) - deliver the selected iOS capture path - [Android capture](/quest/m2/mobile-capture-android.md) - deliver the selected Android capture and codec path diff --git a/sh/dart/generate.sh b/sh/dart/generate.sh index 92f916a694c..828d43255c7 100755 --- a/sh/dart/generate.sh +++ b/sh/dart/generate.sh @@ -35,7 +35,7 @@ done < <(env -0) shopt -u nocasematch host=$(rustc -vV | sed -n 's/^host: //p') -env -i "${hook_env[@]}" cargo build --locked --release --package moq-ffi --no-default-features \ +env -i "${hook_env[@]}" cargo build --locked --release --package moq-ffi \ --target "$host" \ --manifest-path "$WORKSPACE_DIR/Cargo.toml" diff --git a/sh/gh/ffi.test.ts b/sh/gh/ffi.test.ts index f6f753f9f15..9cc3292f89e 100644 --- a/sh/gh/ffi.test.ts +++ b/sh/gh/ffi.test.ts @@ -47,7 +47,6 @@ test("shared default builds cover each consumer exactly once", async () => { expect(all.length - targets.length).toBe(5); expect(shared.on.push?.tags).toEqual(["moq-ffi-v*"]); const dart = await read("release-dart-ffi"); - expect(dart.jobs.ffi.with?.["default-features"]).toBe(false); expect(dart.on.push?.tags).toEqual(["moq-ffi-v*"]); }); From 2d82462d899e359e7de71c4c4779e9740c988c70 Mon Sep 17 00:00:00 2001 From: Luke Curley <432854+kixelated@users.noreply.github.com> Date: Fri, 16 Oct 2026 23:04:05 -0700 Subject: [PATCH 3/8] quest(m2): raise the moq_ffi floor when cutting the Dart release Co-Authored-By: Claude Opus 5.5 --- quest/m2/release/dart-publish.md | 1 + 1 file changed, 1 insertion(+) diff --git a/quest/m2/release/dart-publish.md b/quest/m2/release/dart-publish.md index 1667fabadb4..b1cd8ee3f94 100644 --- a/quest/m2/release/dart-publish.md +++ b/quest/m2/release/dart-publish.md @@ -21,6 +21,7 @@ can proceed independently; cutting the tag cannot. - Confirm trusted publishing is configured for `moq` (repository `moq-dev/moq`, tag pattern `moq-dart-v{{version}}`). +- Raise `dart/moq/pubspec.yaml`'s `moq_ffi` floor to the release the wrapper now needs (the media namespace and codec types), since `^0.4.3` resolves bindings without them. - Cut the next `moq-dart-v*` release with the binding breaks and confirm the workflow publishes it. - Verify the published `moq_ffi` resolves its native asset from a clean machine with no monorepo checkout, since that download path is the one CI From 52accb0bf10fad24faa2ef8086be6cccbf4a4288 Mon Sep 17 00:00:00 2001 From: Luke Curley <432854+kixelated@users.noreply.github.com> Date: Fri, 16 Oct 2026 23:52:15 -0700 Subject: [PATCH 4/8] chore(dart): regenerate bindings on latest main Co-Authored-By: Claude Opus 5.5 --- dart/moq_ffi/lib/src/uniffi_runtime.dart | 2 -- 1 file changed, 2 deletions(-) diff --git a/dart/moq_ffi/lib/src/uniffi_runtime.dart b/dart/moq_ffi/lib/src/uniffi_runtime.dart index 1eefdf6293d..ab87a64ed3f 100644 --- a/dart/moq_ffi/lib/src/uniffi_runtime.dart +++ b/dart/moq_ffi/lib/src/uniffi_runtime.dart @@ -8,7 +8,6 @@ import "dart:ffi"; import "dart:io" show Platform, File, Directory; import "dart:isolate"; import "dart:typed_data"; - import "package:ffi/ffi.dart"; class UniffiInternalError implements Exception { @@ -248,7 +247,6 @@ mixin FfiConverterPrimitive on FfiConverter { @override T lower(T value) => value; } - Uint8List createUint8ListFromInt(int value) { int length = value.bitLength ~/ 8 + 1; if (length != 4 && length != 8) { From 5f6de2baa7ca43891b91f42144f3ce58f061fe30 Mon Sep 17 00:00:00 2001 From: Luke Curley <432854+kixelated@users.noreply.github.com> Date: Sat, 17 Oct 2026 01:48:02 -0700 Subject: [PATCH 5/8] fix(dart): alias the audio Preset and describe planar PCM frames Co-Authored-By: Claude Opus 5.5 --- dart/moq/lib/audio.dart | 7 +++++-- dart/moq/test/moq_test.dart | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dart/moq/lib/audio.dart b/dart/moq/lib/audio.dart index af57b20d77b..90af54ecc34 100644 --- a/dart/moq/lib/audio.dart +++ b/dart/moq/lib/audio.dart @@ -22,13 +22,13 @@ typedef Consumer = MoqAudioConsumer; /// The PCM layout written to a [Producer]. typedef EncoderInput = MoqAudioEncoderInput; -/// The codec side: codec, track name, rate, channels, bitrate, and frame duration (0 takes the codec's own frame). +/// The codec side: codec, track name, rate, channels, bitrate, preset, and frame duration (0 takes the codec's own frame). typedef EncoderOutput = MoqAudioEncoderOutput; /// The PCM layout a [Consumer] delivers and how stale a group may get. typedef DecoderOutput = MoqAudioDecoderOutput; -/// Interleaved PCM with its presentation timestamp. +/// PCM in the configured [SampleFormat], planar or interleaved, with its presentation timestamp. typedef Frame = MoqAudioFrame; /// One encoded payload from an [Encoder]. @@ -43,6 +43,9 @@ typedef Codec = MoqAudioCodec; /// A raw PCM sample layout. typedef SampleFormat = MoqAudioSampleFormat; +/// How the encoder trades latency for compression; null in [EncoderOutput] means `balanced`. +typedef Preset = MoqAudioPreset; + /// Duration view over a PCM frame's timestamp. extension AudioFrameDuration on MoqAudioFrame { /// Presentation timestamp of the first sample. diff --git a/dart/moq/test/moq_test.dart b/dart/moq/test/moq_test.dart index 78265e27ff0..64d4b0e2d64 100644 --- a/dart/moq/test/moq_test.dart +++ b/dart/moq/test/moq_test.dart @@ -488,6 +488,7 @@ void main() { output: moq_audio.EncoderOutput( codec: moq_audio.Codec.opus(), track: 'mic', + preset: moq_audio.Preset.lowLatency, ), ); producer.write( From 0a4b0f6ac45ca31fef6ab90ddde52ac7cb25bc02 Mon Sep 17 00:00:00 2001 From: Luke Curley <432854+kixelated@users.noreply.github.com> Date: Sat, 17 Oct 2026 02:51:57 -0700 Subject: [PATCH 6/8] chore(dart): regenerate bindings and follow the rendition id rename Co-Authored-By: Claude Opus 5.5 --- dart/moq/test/moq_test.dart | 2 +- dart/moq_ffi/lib/src/moq.dart | 14922 ++++++++++++++++++++------------ doc/lib/dart/index.md | 2 +- 3 files changed, 9264 insertions(+), 5662 deletions(-) diff --git a/dart/moq/test/moq_test.dart b/dart/moq/test/moq_test.dart index 64d4b0e2d64..7c05d57dec5 100644 --- a/dart/moq/test/moq_test.dart +++ b/dart/moq/test/moq_test.dart @@ -443,7 +443,7 @@ void main() { final catalog = await catalogs.next().timeout(timeout); final decoder = await moq_video.Consumer.subscribe( broadcast: consumer, - name: 'camera', + id: 'camera', catalogVideo: catalog!.video['camera']!, output: moq_video.DecoderOutput(), ).timeout(timeout); diff --git a/dart/moq_ffi/lib/src/moq.dart b/dart/moq_ffi/lib/src/moq.dart index 671fdfcbd49..a1cecf3d669 100644 --- a/dart/moq_ffi/lib/src/moq.dart +++ b/dart/moq_ffi/lib/src/moq.dart @@ -8,44 +8,66 @@ import "dart:ffi"; import "dart:io" show Platform, File, Directory; import "dart:isolate"; import "dart:typed_data"; - import "package:ffi/ffi.dart"; - import "uniffi_runtime.dart"; export "uniffi_runtime.dart"; -class MoqFetchGroupOptions { - final int priority; +class MoqAudioDecoderOutput { + final MoqAudioSampleFormat format; + final int? sampleRate; + final int? channels; final int? maxDelayUs; - MoqFetchGroupOptions({this.priority = 0, this.maxDelayUs = null}); + MoqAudioDecoderOutput({ + required this.format, + this.sampleRate = null, + this.channels = null, + this.maxDelayUs = null, + }); } -class FfiConverterMoqFetchGroupOptions { - static MoqFetchGroupOptions lift(RustBuffer buf) { - return FfiConverterMoqFetchGroupOptions.read(buf.asUint8List()).value; +class FfiConverterMoqAudioDecoderOutput { + static MoqAudioDecoderOutput lift(RustBuffer buf) { + return FfiConverterMoqAudioDecoderOutput.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final priority_lifted = FfiConverterUInt8.read( + final format_lifted = FfiConverterMoqAudioSampleFormat.read( Uint8List.view(buf.buffer, new_offset), ); - final priority = priority_lifted.value; - new_offset += priority_lifted.bytesRead; + final format = format_lifted.value; + new_offset += format_lifted.bytesRead; + final sampleRate_lifted = FfiConverterOptionalUInt32.read( + Uint8List.view(buf.buffer, new_offset), + ); + final sampleRate = sampleRate_lifted.value; + new_offset += sampleRate_lifted.bytesRead; + final channels_lifted = FfiConverterOptionalUInt32.read( + Uint8List.view(buf.buffer, new_offset), + ); + final channels = channels_lifted.value; + new_offset += channels_lifted.bytesRead; final maxDelayUs_lifted = FfiConverterOptionalUInt64.read( Uint8List.view(buf.buffer, new_offset), ); final maxDelayUs = maxDelayUs_lifted.value; new_offset += maxDelayUs_lifted.bytesRead; return LiftRetVal( - MoqFetchGroupOptions(priority: priority, maxDelayUs: maxDelayUs), + MoqAudioDecoderOutput( + format: format, + sampleRate: sampleRate, + channels: channels, + maxDelayUs: maxDelayUs, + ), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(MoqFetchGroupOptions value) { + static RustBuffer lower(MoqAudioDecoderOutput value) { final total_length = - FfiConverterUInt8.allocationSize(value.priority) + + FfiConverterMoqAudioSampleFormat.allocationSize(value.format) + + FfiConverterOptionalUInt32.allocationSize(value.sampleRate) + + FfiConverterOptionalUInt32.allocationSize(value.channels) + FfiConverterOptionalUInt64.allocationSize(value.maxDelayUs) + 0; final buf = Uint8List(total_length); @@ -53,10 +75,18 @@ class FfiConverterMoqFetchGroupOptions { return toRustBuffer(buf); } - static int write(MoqFetchGroupOptions value, Uint8List buf) { + static int write(MoqAudioDecoderOutput value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += FfiConverterUInt8.write( - value.priority, + new_offset += FfiConverterMoqAudioSampleFormat.write( + value.format, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalUInt32.write( + value.sampleRate, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalUInt32.write( + value.channels, Uint8List.view(buf.buffer, new_offset), ); new_offset += FfiConverterOptionalUInt64.write( @@ -66,2485 +96,2609 @@ class FfiConverterMoqFetchGroupOptions { return new_offset - buf.offsetInBytes; } - static int allocationSize(MoqFetchGroupOptions value) { - return FfiConverterUInt8.allocationSize(value.priority) + + static int allocationSize(MoqAudioDecoderOutput value) { + return FfiConverterMoqAudioSampleFormat.allocationSize(value.format) + + FfiConverterOptionalUInt32.allocationSize(value.sampleRate) + + FfiConverterOptionalUInt32.allocationSize(value.channels) + FfiConverterOptionalUInt64.allocationSize(value.maxDelayUs) + 0; } } -class MoqSubscription { - final int priority; - final int maxDelayUs; - final int? groupStart; - final int? groupEnd; - MoqSubscription({ - this.priority = 0, - this.maxDelayUs = 0, - this.groupStart = null, - this.groupEnd = null, - }); +class MoqAudioEncoderFinish { + final List packets; + final int discardPadding; + MoqAudioEncoderFinish({required this.packets, required this.discardPadding}); } -class FfiConverterMoqSubscription { - static MoqSubscription lift(RustBuffer buf) { - return FfiConverterMoqSubscription.read(buf.asUint8List()).value; +class FfiConverterMoqAudioEncoderFinish { + static MoqAudioEncoderFinish lift(RustBuffer buf) { + return FfiConverterMoqAudioEncoderFinish.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final priority_lifted = FfiConverterUInt8.read( - Uint8List.view(buf.buffer, new_offset), - ); - final priority = priority_lifted.value; - new_offset += priority_lifted.bytesRead; - final maxDelayUs_lifted = FfiConverterUInt64.read( - Uint8List.view(buf.buffer, new_offset), - ); - final maxDelayUs = maxDelayUs_lifted.value; - new_offset += maxDelayUs_lifted.bytesRead; - final groupStart_lifted = FfiConverterOptionalUInt64.read( + final packets_lifted = FfiConverterSequenceMoqAudioPacket.read( Uint8List.view(buf.buffer, new_offset), ); - final groupStart = groupStart_lifted.value; - new_offset += groupStart_lifted.bytesRead; - final groupEnd_lifted = FfiConverterOptionalUInt64.read( + final packets = packets_lifted.value; + new_offset += packets_lifted.bytesRead; + final discardPadding_lifted = FfiConverterUInt64.read( Uint8List.view(buf.buffer, new_offset), ); - final groupEnd = groupEnd_lifted.value; - new_offset += groupEnd_lifted.bytesRead; + final discardPadding = discardPadding_lifted.value; + new_offset += discardPadding_lifted.bytesRead; return LiftRetVal( - MoqSubscription( - priority: priority, - maxDelayUs: maxDelayUs, - groupStart: groupStart, - groupEnd: groupEnd, - ), + MoqAudioEncoderFinish(packets: packets, discardPadding: discardPadding), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(MoqSubscription value) { + static RustBuffer lower(MoqAudioEncoderFinish value) { final total_length = - FfiConverterUInt8.allocationSize(value.priority) + - FfiConverterUInt64.allocationSize(value.maxDelayUs) + - FfiConverterOptionalUInt64.allocationSize(value.groupStart) + - FfiConverterOptionalUInt64.allocationSize(value.groupEnd) + + FfiConverterSequenceMoqAudioPacket.allocationSize(value.packets) + + FfiConverterUInt64.allocationSize(value.discardPadding) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(MoqSubscription value, Uint8List buf) { + static int write(MoqAudioEncoderFinish value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += FfiConverterUInt8.write( - value.priority, + new_offset += FfiConverterSequenceMoqAudioPacket.write( + value.packets, Uint8List.view(buf.buffer, new_offset), ); new_offset += FfiConverterUInt64.write( - value.maxDelayUs, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalUInt64.write( - value.groupStart, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalUInt64.write( - value.groupEnd, + value.discardPadding, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(MoqSubscription value) { - return FfiConverterUInt8.allocationSize(value.priority) + - FfiConverterUInt64.allocationSize(value.maxDelayUs) + - FfiConverterOptionalUInt64.allocationSize(value.groupStart) + - FfiConverterOptionalUInt64.allocationSize(value.groupEnd) + + static int allocationSize(MoqAudioEncoderFinish value) { + return FfiConverterSequenceMoqAudioPacket.allocationSize(value.packets) + + FfiConverterUInt64.allocationSize(value.discardPadding) + 0; } } -class MoqProtocolException { - final MoqErrorScope scope; - final int code; - final MoqProtocolKind kind; - final String message; - MoqProtocolException({ - required this.scope, - required this.code, - required this.kind, - required this.message, +class MoqAudioEncoderInput { + final MoqAudioSampleFormat format; + final int sampleRate; + final int channels; + MoqAudioEncoderInput({ + required this.format, + required this.sampleRate, + required this.channels, }); } -class FfiConverterMoqProtocolError { - static MoqProtocolException lift(RustBuffer buf) { - return FfiConverterMoqProtocolError.read(buf.asUint8List()).value; +class FfiConverterMoqAudioEncoderInput { + static MoqAudioEncoderInput lift(RustBuffer buf) { + return FfiConverterMoqAudioEncoderInput.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final scope_lifted = FfiConverterMoqErrorScope.read( - Uint8List.view(buf.buffer, new_offset), - ); - final scope = scope_lifted.value; - new_offset += scope_lifted.bytesRead; - final code_lifted = FfiConverterUInt32.read( + final format_lifted = FfiConverterMoqAudioSampleFormat.read( Uint8List.view(buf.buffer, new_offset), ); - final code = code_lifted.value; - new_offset += code_lifted.bytesRead; - final kind_lifted = FfiConverterMoqProtocolKind.read( + final format = format_lifted.value; + new_offset += format_lifted.bytesRead; + final sampleRate_lifted = FfiConverterUInt32.read( Uint8List.view(buf.buffer, new_offset), ); - final kind = kind_lifted.value; - new_offset += kind_lifted.bytesRead; - final message_lifted = FfiConverterString.read( + final sampleRate = sampleRate_lifted.value; + new_offset += sampleRate_lifted.bytesRead; + final channels_lifted = FfiConverterUInt32.read( Uint8List.view(buf.buffer, new_offset), ); - final message = message_lifted.value; - new_offset += message_lifted.bytesRead; + final channels = channels_lifted.value; + new_offset += channels_lifted.bytesRead; return LiftRetVal( - MoqProtocolException( - scope: scope, - code: code, - kind: kind, - message: message, + MoqAudioEncoderInput( + format: format, + sampleRate: sampleRate, + channels: channels, ), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(MoqProtocolException value) { + static RustBuffer lower(MoqAudioEncoderInput value) { final total_length = - FfiConverterMoqErrorScope.allocationSize(value.scope) + - FfiConverterUInt32.allocationSize(value.code) + - FfiConverterMoqProtocolKind.allocationSize(value.kind) + - FfiConverterString.allocationSize(value.message) + + FfiConverterMoqAudioSampleFormat.allocationSize(value.format) + + FfiConverterUInt32.allocationSize(value.sampleRate) + + FfiConverterUInt32.allocationSize(value.channels) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(MoqProtocolException value, Uint8List buf) { + static int write(MoqAudioEncoderInput value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += FfiConverterMoqErrorScope.write( - value.scope, + new_offset += FfiConverterMoqAudioSampleFormat.write( + value.format, Uint8List.view(buf.buffer, new_offset), ); new_offset += FfiConverterUInt32.write( - value.code, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterMoqProtocolKind.write( - value.kind, + value.sampleRate, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterString.write( - value.message, + new_offset += FfiConverterUInt32.write( + value.channels, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(MoqProtocolException value) { - return FfiConverterMoqErrorScope.allocationSize(value.scope) + - FfiConverterUInt32.allocationSize(value.code) + - FfiConverterMoqProtocolKind.allocationSize(value.kind) + - FfiConverterString.allocationSize(value.message) + + static int allocationSize(MoqAudioEncoderInput value) { + return FfiConverterMoqAudioSampleFormat.allocationSize(value.format) + + FfiConverterUInt32.allocationSize(value.sampleRate) + + FfiConverterUInt32.allocationSize(value.channels) + 0; } } -class MoqFlateConfig { - final bool compression; - final String? mime; - MoqFlateConfig({this.compression = false, this.mime = null}); +class MoqAudioEncoderOutput { + final MoqAudioCodec codec; + final String? track; + final int? sampleRate; + final int? channels; + final int? bitrate; + final int frameDurationUs; + final MoqAudioPreset? preset; + MoqAudioEncoderOutput({ + required this.codec, + this.track = null, + this.sampleRate = null, + this.channels = null, + this.bitrate = null, + this.frameDurationUs = 0, + this.preset = null, + }); } -class FfiConverterMoqFlateConfig { - static MoqFlateConfig lift(RustBuffer buf) { - return FfiConverterMoqFlateConfig.read(buf.asUint8List()).value; +class FfiConverterMoqAudioEncoderOutput { + static MoqAudioEncoderOutput lift(RustBuffer buf) { + return FfiConverterMoqAudioEncoderOutput.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final compression_lifted = FfiConverterBool.read( + final codec_lifted = FfiConverterMoqAudioCodec.read( Uint8List.view(buf.buffer, new_offset), ); - final compression = compression_lifted.value; - new_offset += compression_lifted.bytesRead; - final mime_lifted = FfiConverterOptionalString.read( + final codec = codec_lifted.value; + new_offset += codec_lifted.bytesRead; + final track_lifted = FfiConverterOptionalString.read( Uint8List.view(buf.buffer, new_offset), ); - final mime = mime_lifted.value; - new_offset += mime_lifted.bytesRead; + final track = track_lifted.value; + new_offset += track_lifted.bytesRead; + final sampleRate_lifted = FfiConverterOptionalUInt32.read( + Uint8List.view(buf.buffer, new_offset), + ); + final sampleRate = sampleRate_lifted.value; + new_offset += sampleRate_lifted.bytesRead; + final channels_lifted = FfiConverterOptionalUInt32.read( + Uint8List.view(buf.buffer, new_offset), + ); + final channels = channels_lifted.value; + new_offset += channels_lifted.bytesRead; + final bitrate_lifted = FfiConverterOptionalUInt32.read( + Uint8List.view(buf.buffer, new_offset), + ); + final bitrate = bitrate_lifted.value; + new_offset += bitrate_lifted.bytesRead; + final frameDurationUs_lifted = FfiConverterUInt32.read( + Uint8List.view(buf.buffer, new_offset), + ); + final frameDurationUs = frameDurationUs_lifted.value; + new_offset += frameDurationUs_lifted.bytesRead; + final preset_lifted = FfiConverterOptionalMoqAudioPreset.read( + Uint8List.view(buf.buffer, new_offset), + ); + final preset = preset_lifted.value; + new_offset += preset_lifted.bytesRead; return LiftRetVal( - MoqFlateConfig(compression: compression, mime: mime), + MoqAudioEncoderOutput( + codec: codec, + track: track, + sampleRate: sampleRate, + channels: channels, + bitrate: bitrate, + frameDurationUs: frameDurationUs, + preset: preset, + ), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(MoqFlateConfig value) { + static RustBuffer lower(MoqAudioEncoderOutput value) { final total_length = - FfiConverterBool.allocationSize(value.compression) + - FfiConverterOptionalString.allocationSize(value.mime) + + FfiConverterMoqAudioCodec.allocationSize(value.codec) + + FfiConverterOptionalString.allocationSize(value.track) + + FfiConverterOptionalUInt32.allocationSize(value.sampleRate) + + FfiConverterOptionalUInt32.allocationSize(value.channels) + + FfiConverterOptionalUInt32.allocationSize(value.bitrate) + + FfiConverterUInt32.allocationSize(value.frameDurationUs) + + FfiConverterOptionalMoqAudioPreset.allocationSize(value.preset) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(MoqFlateConfig value, Uint8List buf) { + static int write(MoqAudioEncoderOutput value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += FfiConverterBool.write( - value.compression, + new_offset += FfiConverterMoqAudioCodec.write( + value.codec, Uint8List.view(buf.buffer, new_offset), ); new_offset += FfiConverterOptionalString.write( - value.mime, + value.track, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalUInt32.write( + value.sampleRate, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalUInt32.write( + value.channels, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalUInt32.write( + value.bitrate, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterUInt32.write( + value.frameDurationUs, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalMoqAudioPreset.write( + value.preset, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(MoqFlateConfig value) { - return FfiConverterBool.allocationSize(value.compression) + - FfiConverterOptionalString.allocationSize(value.mime) + + static int allocationSize(MoqAudioEncoderOutput value) { + return FfiConverterMoqAudioCodec.allocationSize(value.codec) + + FfiConverterOptionalString.allocationSize(value.track) + + FfiConverterOptionalUInt32.allocationSize(value.sampleRate) + + FfiConverterOptionalUInt32.allocationSize(value.channels) + + FfiConverterOptionalUInt32.allocationSize(value.bitrate) + + FfiConverterUInt32.allocationSize(value.frameDurationUs) + + FfiConverterOptionalMoqAudioPreset.allocationSize(value.preset) + 0; } } -class MoqJsonSnapshotConfig { - final int deltaRatio; - final bool compression; - MoqJsonSnapshotConfig({this.deltaRatio = 8, this.compression = false}); +class MoqAudioFrame { + final int timestampUs; + final Uint8List data; + MoqAudioFrame({required this.timestampUs, required this.data}); } -class FfiConverterMoqJsonSnapshotConfig { - static MoqJsonSnapshotConfig lift(RustBuffer buf) { - return FfiConverterMoqJsonSnapshotConfig.read(buf.asUint8List()).value; +class FfiConverterMoqAudioFrame { + static MoqAudioFrame lift(RustBuffer buf) { + return FfiConverterMoqAudioFrame.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final deltaRatio_lifted = FfiConverterUInt32.read( + final timestampUs_lifted = FfiConverterUInt64.read( Uint8List.view(buf.buffer, new_offset), ); - final deltaRatio = deltaRatio_lifted.value; - new_offset += deltaRatio_lifted.bytesRead; - final compression_lifted = FfiConverterBool.read( + final timestampUs = timestampUs_lifted.value; + new_offset += timestampUs_lifted.bytesRead; + final data_lifted = FfiConverterUint8List.read( Uint8List.view(buf.buffer, new_offset), ); - final compression = compression_lifted.value; - new_offset += compression_lifted.bytesRead; + final data = data_lifted.value; + new_offset += data_lifted.bytesRead; return LiftRetVal( - MoqJsonSnapshotConfig(deltaRatio: deltaRatio, compression: compression), + MoqAudioFrame(timestampUs: timestampUs, data: data), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(MoqJsonSnapshotConfig value) { + static RustBuffer lower(MoqAudioFrame value) { final total_length = - FfiConverterUInt32.allocationSize(value.deltaRatio) + - FfiConverterBool.allocationSize(value.compression) + + FfiConverterUInt64.allocationSize(value.timestampUs) + + FfiConverterUint8List.allocationSize(value.data) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(MoqJsonSnapshotConfig value, Uint8List buf) { + static int write(MoqAudioFrame value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += FfiConverterUInt32.write( - value.deltaRatio, + new_offset += FfiConverterUInt64.write( + value.timestampUs, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterBool.write( - value.compression, + new_offset += FfiConverterUint8List.write( + value.data, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(MoqJsonSnapshotConfig value) { - return FfiConverterUInt32.allocationSize(value.deltaRatio) + - FfiConverterBool.allocationSize(value.compression) + + static int allocationSize(MoqAudioFrame value) { + return FfiConverterUInt64.allocationSize(value.timestampUs) + + FfiConverterUint8List.allocationSize(value.data) + 0; } } -class MoqJsonStreamConfig { - final bool compression; - MoqJsonStreamConfig({this.compression = false}); +class MoqAudioPacket { + final Uint8List data; + MoqAudioPacket({required this.data}); } -class FfiConverterMoqJsonStreamConfig { - static MoqJsonStreamConfig lift(RustBuffer buf) { - return FfiConverterMoqJsonStreamConfig.read(buf.asUint8List()).value; +class FfiConverterMoqAudioPacket { + static MoqAudioPacket lift(RustBuffer buf) { + return FfiConverterMoqAudioPacket.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final compression_lifted = FfiConverterBool.read( + final data_lifted = FfiConverterUint8List.read( Uint8List.view(buf.buffer, new_offset), ); - final compression = compression_lifted.value; - new_offset += compression_lifted.bytesRead; + final data = data_lifted.value; + new_offset += data_lifted.bytesRead; return LiftRetVal( - MoqJsonStreamConfig(compression: compression), + MoqAudioPacket(data: data), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(MoqJsonStreamConfig value) { - final total_length = FfiConverterBool.allocationSize(value.compression) + 0; + static RustBuffer lower(MoqAudioPacket value) { + final total_length = FfiConverterUint8List.allocationSize(value.data) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(MoqJsonStreamConfig value, Uint8List buf) { + static int write(MoqAudioPacket value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += FfiConverterBool.write( - value.compression, + new_offset += FfiConverterUint8List.write( + value.data, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(MoqJsonStreamConfig value) { - return FfiConverterBool.allocationSize(value.compression) + 0; + static int allocationSize(MoqAudioPacket value) { + return FfiConverterUint8List.allocationSize(value.data) + 0; } } -class MoqAudio { - final String? label; - final String? broadcast; - final String? track; - final String codec; - final Uint8List? description; - final int sampleRate; - final int channelCount; - final int? bitrate; - final bool enabled; - final MoqContainer container; - final int? jitterUs; - MoqAudio({ - this.label = null, - this.broadcast = null, - this.track = null, - required this.codec, - this.description, - required this.sampleRate, - required this.channelCount, - this.bitrate, - this.enabled = true, - required this.container, - this.jitterUs = null, - }); +class MoqFetchGroupOptions { + final int priority; + final int? maxDelayUs; + MoqFetchGroupOptions({this.priority = 0, this.maxDelayUs = null}); } -class FfiConverterMoqAudio { - static MoqAudio lift(RustBuffer buf) { - return FfiConverterMoqAudio.read(buf.asUint8List()).value; +class FfiConverterMoqFetchGroupOptions { + static MoqFetchGroupOptions lift(RustBuffer buf) { + return FfiConverterMoqFetchGroupOptions.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final label_lifted = FfiConverterOptionalString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final label = label_lifted.value; - new_offset += label_lifted.bytesRead; - final broadcast_lifted = FfiConverterOptionalString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final broadcast = broadcast_lifted.value; - new_offset += broadcast_lifted.bytesRead; - final track_lifted = FfiConverterOptionalString.read( + final priority_lifted = FfiConverterUInt8.read( Uint8List.view(buf.buffer, new_offset), ); - final track = track_lifted.value; - new_offset += track_lifted.bytesRead; - final codec_lifted = FfiConverterString.read( + final priority = priority_lifted.value; + new_offset += priority_lifted.bytesRead; + final maxDelayUs_lifted = FfiConverterOptionalUInt64.read( Uint8List.view(buf.buffer, new_offset), ); - final codec = codec_lifted.value; - new_offset += codec_lifted.bytesRead; - final description_lifted = FfiConverterOptionalUint8List.read( - Uint8List.view(buf.buffer, new_offset), + final maxDelayUs = maxDelayUs_lifted.value; + new_offset += maxDelayUs_lifted.bytesRead; + return LiftRetVal( + MoqFetchGroupOptions(priority: priority, maxDelayUs: maxDelayUs), + new_offset - buf.offsetInBytes, ); - final description = description_lifted.value; - new_offset += description_lifted.bytesRead; - final sampleRate_lifted = FfiConverterUInt32.read( + } + + static RustBuffer lower(MoqFetchGroupOptions value) { + final total_length = + FfiConverterUInt8.allocationSize(value.priority) + + FfiConverterOptionalUInt64.allocationSize(value.maxDelayUs) + + 0; + final buf = Uint8List(total_length); + write(value, buf); + return toRustBuffer(buf); + } + + static int write(MoqFetchGroupOptions value, Uint8List buf) { + int new_offset = buf.offsetInBytes; + new_offset += FfiConverterUInt8.write( + value.priority, Uint8List.view(buf.buffer, new_offset), ); - final sampleRate = sampleRate_lifted.value; - new_offset += sampleRate_lifted.bytesRead; - final channelCount_lifted = FfiConverterUInt32.read( + new_offset += FfiConverterOptionalUInt64.write( + value.maxDelayUs, Uint8List.view(buf.buffer, new_offset), ); - final channelCount = channelCount_lifted.value; - new_offset += channelCount_lifted.bytesRead; - final bitrate_lifted = FfiConverterOptionalUInt64.read( + return new_offset - buf.offsetInBytes; + } + + static int allocationSize(MoqFetchGroupOptions value) { + return FfiConverterUInt8.allocationSize(value.priority) + + FfiConverterOptionalUInt64.allocationSize(value.maxDelayUs) + + 0; + } +} + +class MoqSubscription { + final int priority; + final int maxDelayUs; + final int? groupStart; + final int? groupEnd; + MoqSubscription({ + this.priority = 0, + this.maxDelayUs = 0, + this.groupStart = null, + this.groupEnd = null, + }); +} + +class FfiConverterMoqSubscription { + static MoqSubscription lift(RustBuffer buf) { + return FfiConverterMoqSubscription.read(buf.asUint8List()).value; + } + + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final priority_lifted = FfiConverterUInt8.read( Uint8List.view(buf.buffer, new_offset), ); - final bitrate = bitrate_lifted.value; - new_offset += bitrate_lifted.bytesRead; - final enabled_lifted = FfiConverterBool.read( + final priority = priority_lifted.value; + new_offset += priority_lifted.bytesRead; + final maxDelayUs_lifted = FfiConverterUInt64.read( Uint8List.view(buf.buffer, new_offset), ); - final enabled = enabled_lifted.value; - new_offset += enabled_lifted.bytesRead; - final container_lifted = FfiConverterMoqContainer.read( + final maxDelayUs = maxDelayUs_lifted.value; + new_offset += maxDelayUs_lifted.bytesRead; + final groupStart_lifted = FfiConverterOptionalUInt64.read( Uint8List.view(buf.buffer, new_offset), ); - final container = container_lifted.value; - new_offset += container_lifted.bytesRead; - final jitterUs_lifted = FfiConverterOptionalUInt64.read( + final groupStart = groupStart_lifted.value; + new_offset += groupStart_lifted.bytesRead; + final groupEnd_lifted = FfiConverterOptionalUInt64.read( Uint8List.view(buf.buffer, new_offset), ); - final jitterUs = jitterUs_lifted.value; - new_offset += jitterUs_lifted.bytesRead; + final groupEnd = groupEnd_lifted.value; + new_offset += groupEnd_lifted.bytesRead; return LiftRetVal( - MoqAudio( - label: label, - broadcast: broadcast, - track: track, - codec: codec, - description: description, - sampleRate: sampleRate, - channelCount: channelCount, - bitrate: bitrate, - enabled: enabled, - container: container, - jitterUs: jitterUs, + MoqSubscription( + priority: priority, + maxDelayUs: maxDelayUs, + groupStart: groupStart, + groupEnd: groupEnd, ), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(MoqAudio value) { + static RustBuffer lower(MoqSubscription value) { final total_length = - FfiConverterOptionalString.allocationSize(value.label) + - FfiConverterOptionalString.allocationSize(value.broadcast) + - FfiConverterOptionalString.allocationSize(value.track) + - FfiConverterString.allocationSize(value.codec) + - FfiConverterOptionalUint8List.allocationSize(value.description) + - FfiConverterUInt32.allocationSize(value.sampleRate) + - FfiConverterUInt32.allocationSize(value.channelCount) + - FfiConverterOptionalUInt64.allocationSize(value.bitrate) + - FfiConverterBool.allocationSize(value.enabled) + - FfiConverterMoqContainer.allocationSize(value.container) + - FfiConverterOptionalUInt64.allocationSize(value.jitterUs) + + FfiConverterUInt8.allocationSize(value.priority) + + FfiConverterUInt64.allocationSize(value.maxDelayUs) + + FfiConverterOptionalUInt64.allocationSize(value.groupStart) + + FfiConverterOptionalUInt64.allocationSize(value.groupEnd) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(MoqAudio value, Uint8List buf) { + static int write(MoqSubscription value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += FfiConverterOptionalString.write( - value.label, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalString.write( - value.broadcast, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalString.write( - value.track, + new_offset += FfiConverterUInt8.write( + value.priority, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterString.write( - value.codec, + new_offset += FfiConverterUInt64.write( + value.maxDelayUs, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterOptionalUint8List.write( - value.description, + new_offset += FfiConverterOptionalUInt64.write( + value.groupStart, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterUInt32.write( - value.sampleRate, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterUInt32.write( - value.channelCount, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalUInt64.write( - value.bitrate, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterBool.write( - value.enabled, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterMoqContainer.write( - value.container, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalUInt64.write( - value.jitterUs, + new_offset += FfiConverterOptionalUInt64.write( + value.groupEnd, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(MoqAudio value) { - return FfiConverterOptionalString.allocationSize(value.label) + - FfiConverterOptionalString.allocationSize(value.broadcast) + - FfiConverterOptionalString.allocationSize(value.track) + - FfiConverterString.allocationSize(value.codec) + - FfiConverterOptionalUint8List.allocationSize(value.description) + - FfiConverterUInt32.allocationSize(value.sampleRate) + - FfiConverterUInt32.allocationSize(value.channelCount) + - FfiConverterOptionalUInt64.allocationSize(value.bitrate) + - FfiConverterBool.allocationSize(value.enabled) + - FfiConverterMoqContainer.allocationSize(value.container) + - FfiConverterOptionalUInt64.allocationSize(value.jitterUs) + + static int allocationSize(MoqSubscription value) { + return FfiConverterUInt8.allocationSize(value.priority) + + FfiConverterUInt64.allocationSize(value.maxDelayUs) + + FfiConverterOptionalUInt64.allocationSize(value.groupStart) + + FfiConverterOptionalUInt64.allocationSize(value.groupEnd) + 0; } } -class MoqAudioInit { - final MoqAudioFormat format; - final Uint8List data; - final String? label; - MoqAudioInit({required this.format, required this.data, this.label = null}); +class MoqProtocolException { + final MoqErrorScope scope; + final int code; + final MoqProtocolKind kind; + final String message; + MoqProtocolException({ + required this.scope, + required this.code, + required this.kind, + required this.message, + }); } -class FfiConverterMoqAudioInit { - static MoqAudioInit lift(RustBuffer buf) { - return FfiConverterMoqAudioInit.read(buf.asUint8List()).value; +class FfiConverterMoqProtocolError { + static MoqProtocolException lift(RustBuffer buf) { + return FfiConverterMoqProtocolError.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final format_lifted = FfiConverterMoqAudioFormat.read( + final scope_lifted = FfiConverterMoqErrorScope.read( Uint8List.view(buf.buffer, new_offset), ); - final format = format_lifted.value; - new_offset += format_lifted.bytesRead; - final data_lifted = FfiConverterUint8List.read( + final scope = scope_lifted.value; + new_offset += scope_lifted.bytesRead; + final code_lifted = FfiConverterUInt32.read( Uint8List.view(buf.buffer, new_offset), ); - final data = data_lifted.value; - new_offset += data_lifted.bytesRead; - final label_lifted = FfiConverterOptionalString.read( + final code = code_lifted.value; + new_offset += code_lifted.bytesRead; + final kind_lifted = FfiConverterMoqProtocolKind.read( Uint8List.view(buf.buffer, new_offset), ); - final label = label_lifted.value; - new_offset += label_lifted.bytesRead; + final kind = kind_lifted.value; + new_offset += kind_lifted.bytesRead; + final message_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final message = message_lifted.value; + new_offset += message_lifted.bytesRead; return LiftRetVal( - MoqAudioInit(format: format, data: data, label: label), + MoqProtocolException( + scope: scope, + code: code, + kind: kind, + message: message, + ), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(MoqAudioInit value) { + static RustBuffer lower(MoqProtocolException value) { final total_length = - FfiConverterMoqAudioFormat.allocationSize(value.format) + - FfiConverterUint8List.allocationSize(value.data) + - FfiConverterOptionalString.allocationSize(value.label) + + FfiConverterMoqErrorScope.allocationSize(value.scope) + + FfiConverterUInt32.allocationSize(value.code) + + FfiConverterMoqProtocolKind.allocationSize(value.kind) + + FfiConverterString.allocationSize(value.message) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(MoqAudioInit value, Uint8List buf) { + static int write(MoqProtocolException value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += FfiConverterMoqAudioFormat.write( - value.format, + new_offset += FfiConverterMoqErrorScope.write( + value.scope, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterUint8List.write( - value.data, + new_offset += FfiConverterUInt32.write( + value.code, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterOptionalString.write( - value.label, + new_offset += FfiConverterMoqProtocolKind.write( + value.kind, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterString.write( + value.message, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(MoqAudioInit value) { - return FfiConverterMoqAudioFormat.allocationSize(value.format) + - FfiConverterUint8List.allocationSize(value.data) + - FfiConverterOptionalString.allocationSize(value.label) + + static int allocationSize(MoqProtocolException value) { + return FfiConverterMoqErrorScope.allocationSize(value.scope) + + FfiConverterUInt32.allocationSize(value.code) + + FfiConverterMoqProtocolKind.allocationSize(value.kind) + + FfiConverterString.allocationSize(value.message) + 0; } } -class MoqCatalog { - final Map video; - final Map audio; - final MoqDimensions? display; - final double? rotation; - final bool? flip; - final Map sections; - MoqCatalog({ - required this.video, - required this.audio, - this.display, - this.rotation, - this.flip, - required this.sections, - }); +class MoqFlateConfig { + final bool compression; + final String? mime; + MoqFlateConfig({this.compression = false, this.mime = null}); } -class FfiConverterMoqCatalog { - static MoqCatalog lift(RustBuffer buf) { - return FfiConverterMoqCatalog.read(buf.asUint8List()).value; +class FfiConverterMoqFlateConfig { + static MoqFlateConfig lift(RustBuffer buf) { + return FfiConverterMoqFlateConfig.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final video_lifted = FfiConverterMapStringToMoqVideo.read( - Uint8List.view(buf.buffer, new_offset), - ); - final video = video_lifted.value; - new_offset += video_lifted.bytesRead; - final audio_lifted = FfiConverterMapStringToMoqAudio.read( - Uint8List.view(buf.buffer, new_offset), - ); - final audio = audio_lifted.value; - new_offset += audio_lifted.bytesRead; - final display_lifted = FfiConverterOptionalMoqDimensions.read( - Uint8List.view(buf.buffer, new_offset), - ); - final display = display_lifted.value; - new_offset += display_lifted.bytesRead; - final rotation_lifted = FfiConverterOptionalDouble64.read( - Uint8List.view(buf.buffer, new_offset), - ); - final rotation = rotation_lifted.value; - new_offset += rotation_lifted.bytesRead; - final flip_lifted = FfiConverterOptionalBool.read( + final compression_lifted = FfiConverterBool.read( Uint8List.view(buf.buffer, new_offset), ); - final flip = flip_lifted.value; - new_offset += flip_lifted.bytesRead; - final sections_lifted = FfiConverterMapStringToString.read( + final compression = compression_lifted.value; + new_offset += compression_lifted.bytesRead; + final mime_lifted = FfiConverterOptionalString.read( Uint8List.view(buf.buffer, new_offset), ); - final sections = sections_lifted.value; - new_offset += sections_lifted.bytesRead; + final mime = mime_lifted.value; + new_offset += mime_lifted.bytesRead; return LiftRetVal( - MoqCatalog( - video: video, - audio: audio, - display: display, - rotation: rotation, - flip: flip, - sections: sections, - ), + MoqFlateConfig(compression: compression, mime: mime), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(MoqCatalog value) { + static RustBuffer lower(MoqFlateConfig value) { final total_length = - FfiConverterMapStringToMoqVideo.allocationSize(value.video) + - FfiConverterMapStringToMoqAudio.allocationSize(value.audio) + - FfiConverterOptionalMoqDimensions.allocationSize(value.display) + - FfiConverterOptionalDouble64.allocationSize(value.rotation) + - FfiConverterOptionalBool.allocationSize(value.flip) + - FfiConverterMapStringToString.allocationSize(value.sections) + + FfiConverterBool.allocationSize(value.compression) + + FfiConverterOptionalString.allocationSize(value.mime) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(MoqCatalog value, Uint8List buf) { + static int write(MoqFlateConfig value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += FfiConverterMapStringToMoqVideo.write( - value.video, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterMapStringToMoqAudio.write( - value.audio, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalMoqDimensions.write( - value.display, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalDouble64.write( - value.rotation, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalBool.write( - value.flip, + new_offset += FfiConverterBool.write( + value.compression, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterMapStringToString.write( - value.sections, + new_offset += FfiConverterOptionalString.write( + value.mime, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(MoqCatalog value) { - return FfiConverterMapStringToMoqVideo.allocationSize(value.video) + - FfiConverterMapStringToMoqAudio.allocationSize(value.audio) + - FfiConverterOptionalMoqDimensions.allocationSize(value.display) + - FfiConverterOptionalDouble64.allocationSize(value.rotation) + - FfiConverterOptionalBool.allocationSize(value.flip) + - FfiConverterMapStringToString.allocationSize(value.sections) + + static int allocationSize(MoqFlateConfig value) { + return FfiConverterBool.allocationSize(value.compression) + + FfiConverterOptionalString.allocationSize(value.mime) + 0; } } -class MoqContainerInit { - final MoqContainerFormat format; - final Uint8List data; - final MoqMediaTimebase? timebase; - MoqContainerInit({ - required this.format, - required this.data, - this.timebase = null, - }); +class MoqJsonSnapshotConfig { + final int deltaRatio; + final bool compression; + MoqJsonSnapshotConfig({this.deltaRatio = 8, this.compression = false}); } -class FfiConverterMoqContainerInit { - static MoqContainerInit lift(RustBuffer buf) { - return FfiConverterMoqContainerInit.read(buf.asUint8List()).value; +class FfiConverterMoqJsonSnapshotConfig { + static MoqJsonSnapshotConfig lift(RustBuffer buf) { + return FfiConverterMoqJsonSnapshotConfig.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final format_lifted = FfiConverterMoqContainerFormat.read( - Uint8List.view(buf.buffer, new_offset), - ); - final format = format_lifted.value; - new_offset += format_lifted.bytesRead; - final data_lifted = FfiConverterUint8List.read( + final deltaRatio_lifted = FfiConverterUInt32.read( Uint8List.view(buf.buffer, new_offset), ); - final data = data_lifted.value; - new_offset += data_lifted.bytesRead; - final timebase_lifted = FfiConverterOptionalMoqMediaTimebase.read( + final deltaRatio = deltaRatio_lifted.value; + new_offset += deltaRatio_lifted.bytesRead; + final compression_lifted = FfiConverterBool.read( Uint8List.view(buf.buffer, new_offset), ); - final timebase = timebase_lifted.value; - new_offset += timebase_lifted.bytesRead; + final compression = compression_lifted.value; + new_offset += compression_lifted.bytesRead; return LiftRetVal( - MoqContainerInit(format: format, data: data, timebase: timebase), + MoqJsonSnapshotConfig(deltaRatio: deltaRatio, compression: compression), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(MoqContainerInit value) { + static RustBuffer lower(MoqJsonSnapshotConfig value) { final total_length = - FfiConverterMoqContainerFormat.allocationSize(value.format) + - FfiConverterUint8List.allocationSize(value.data) + - FfiConverterOptionalMoqMediaTimebase.allocationSize(value.timebase) + + FfiConverterUInt32.allocationSize(value.deltaRatio) + + FfiConverterBool.allocationSize(value.compression) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(MoqContainerInit value, Uint8List buf) { + static int write(MoqJsonSnapshotConfig value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += FfiConverterMoqContainerFormat.write( - value.format, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterUint8List.write( - value.data, + new_offset += FfiConverterUInt32.write( + value.deltaRatio, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterOptionalMoqMediaTimebase.write( - value.timebase, + new_offset += FfiConverterBool.write( + value.compression, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(MoqContainerInit value) { - return FfiConverterMoqContainerFormat.allocationSize(value.format) + - FfiConverterUint8List.allocationSize(value.data) + - FfiConverterOptionalMoqMediaTimebase.allocationSize(value.timebase) + + static int allocationSize(MoqJsonSnapshotConfig value) { + return FfiConverterUInt32.allocationSize(value.deltaRatio) + + FfiConverterBool.allocationSize(value.compression) + 0; } } -class MoqContainerStreamInit { - final MoqContainerFormat format; - final MoqMediaTimebase? timebase; - MoqContainerStreamInit({required this.format, this.timebase = null}); +class MoqJsonStreamConfig { + final bool compression; + MoqJsonStreamConfig({this.compression = false}); } -class FfiConverterMoqContainerStreamInit { - static MoqContainerStreamInit lift(RustBuffer buf) { - return FfiConverterMoqContainerStreamInit.read(buf.asUint8List()).value; +class FfiConverterMoqJsonStreamConfig { + static MoqJsonStreamConfig lift(RustBuffer buf) { + return FfiConverterMoqJsonStreamConfig.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final format_lifted = FfiConverterMoqContainerFormat.read( - Uint8List.view(buf.buffer, new_offset), - ); - final format = format_lifted.value; - new_offset += format_lifted.bytesRead; - final timebase_lifted = FfiConverterOptionalMoqMediaTimebase.read( + final compression_lifted = FfiConverterBool.read( Uint8List.view(buf.buffer, new_offset), ); - final timebase = timebase_lifted.value; - new_offset += timebase_lifted.bytesRead; + final compression = compression_lifted.value; + new_offset += compression_lifted.bytesRead; return LiftRetVal( - MoqContainerStreamInit(format: format, timebase: timebase), + MoqJsonStreamConfig(compression: compression), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(MoqContainerStreamInit value) { - final total_length = - FfiConverterMoqContainerFormat.allocationSize(value.format) + - FfiConverterOptionalMoqMediaTimebase.allocationSize(value.timebase) + - 0; + static RustBuffer lower(MoqJsonStreamConfig value) { + final total_length = FfiConverterBool.allocationSize(value.compression) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(MoqContainerStreamInit value, Uint8List buf) { + static int write(MoqJsonStreamConfig value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += FfiConverterMoqContainerFormat.write( - value.format, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalMoqMediaTimebase.write( - value.timebase, + new_offset += FfiConverterBool.write( + value.compression, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(MoqContainerStreamInit value) { - return FfiConverterMoqContainerFormat.allocationSize(value.format) + - FfiConverterOptionalMoqMediaTimebase.allocationSize(value.timebase) + - 0; + static int allocationSize(MoqJsonStreamConfig value) { + return FfiConverterBool.allocationSize(value.compression) + 0; } } -class MoqDatagram { - final int sequence; - final int? timestampUs; - final Uint8List payload; - MoqDatagram({ - this.sequence = 0, - this.timestampUs = null, - required this.payload, +class MoqAudio { + final String? label; + final String? broadcast; + final String? track; + final String codec; + final Uint8List? description; + final int sampleRate; + final int channelCount; + final int? bitrate; + final bool enabled; + final MoqContainer container; + final int? jitterUs; + MoqAudio({ + this.label = null, + this.broadcast = null, + this.track = null, + required this.codec, + this.description, + required this.sampleRate, + required this.channelCount, + this.bitrate, + this.enabled = true, + required this.container, + this.jitterUs = null, }); } -class FfiConverterMoqDatagram { - static MoqDatagram lift(RustBuffer buf) { - return FfiConverterMoqDatagram.read(buf.asUint8List()).value; +class FfiConverterMoqAudio { + static MoqAudio lift(RustBuffer buf) { + return FfiConverterMoqAudio.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final sequence_lifted = FfiConverterUInt64.read( + final label_lifted = FfiConverterOptionalString.read( Uint8List.view(buf.buffer, new_offset), ); - final sequence = sequence_lifted.value; - new_offset += sequence_lifted.bytesRead; - final timestampUs_lifted = FfiConverterOptionalUInt64.read( + final label = label_lifted.value; + new_offset += label_lifted.bytesRead; + final broadcast_lifted = FfiConverterOptionalString.read( Uint8List.view(buf.buffer, new_offset), ); - final timestampUs = timestampUs_lifted.value; - new_offset += timestampUs_lifted.bytesRead; - final payload_lifted = FfiConverterUint8List.read( + final broadcast = broadcast_lifted.value; + new_offset += broadcast_lifted.bytesRead; + final track_lifted = FfiConverterOptionalString.read( Uint8List.view(buf.buffer, new_offset), ); - final payload = payload_lifted.value; - new_offset += payload_lifted.bytesRead; + final track = track_lifted.value; + new_offset += track_lifted.bytesRead; + final codec_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final codec = codec_lifted.value; + new_offset += codec_lifted.bytesRead; + final description_lifted = FfiConverterOptionalUint8List.read( + Uint8List.view(buf.buffer, new_offset), + ); + final description = description_lifted.value; + new_offset += description_lifted.bytesRead; + final sampleRate_lifted = FfiConverterUInt32.read( + Uint8List.view(buf.buffer, new_offset), + ); + final sampleRate = sampleRate_lifted.value; + new_offset += sampleRate_lifted.bytesRead; + final channelCount_lifted = FfiConverterUInt32.read( + Uint8List.view(buf.buffer, new_offset), + ); + final channelCount = channelCount_lifted.value; + new_offset += channelCount_lifted.bytesRead; + final bitrate_lifted = FfiConverterOptionalUInt64.read( + Uint8List.view(buf.buffer, new_offset), + ); + final bitrate = bitrate_lifted.value; + new_offset += bitrate_lifted.bytesRead; + final enabled_lifted = FfiConverterBool.read( + Uint8List.view(buf.buffer, new_offset), + ); + final enabled = enabled_lifted.value; + new_offset += enabled_lifted.bytesRead; + final container_lifted = FfiConverterMoqContainer.read( + Uint8List.view(buf.buffer, new_offset), + ); + final container = container_lifted.value; + new_offset += container_lifted.bytesRead; + final jitterUs_lifted = FfiConverterOptionalUInt64.read( + Uint8List.view(buf.buffer, new_offset), + ); + final jitterUs = jitterUs_lifted.value; + new_offset += jitterUs_lifted.bytesRead; return LiftRetVal( - MoqDatagram( - sequence: sequence, - timestampUs: timestampUs, - payload: payload, + MoqAudio( + label: label, + broadcast: broadcast, + track: track, + codec: codec, + description: description, + sampleRate: sampleRate, + channelCount: channelCount, + bitrate: bitrate, + enabled: enabled, + container: container, + jitterUs: jitterUs, ), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(MoqDatagram value) { + static RustBuffer lower(MoqAudio value) { final total_length = - FfiConverterUInt64.allocationSize(value.sequence) + - FfiConverterOptionalUInt64.allocationSize(value.timestampUs) + - FfiConverterUint8List.allocationSize(value.payload) + + FfiConverterOptionalString.allocationSize(value.label) + + FfiConverterOptionalString.allocationSize(value.broadcast) + + FfiConverterOptionalString.allocationSize(value.track) + + FfiConverterString.allocationSize(value.codec) + + FfiConverterOptionalUint8List.allocationSize(value.description) + + FfiConverterUInt32.allocationSize(value.sampleRate) + + FfiConverterUInt32.allocationSize(value.channelCount) + + FfiConverterOptionalUInt64.allocationSize(value.bitrate) + + FfiConverterBool.allocationSize(value.enabled) + + FfiConverterMoqContainer.allocationSize(value.container) + + FfiConverterOptionalUInt64.allocationSize(value.jitterUs) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(MoqDatagram value, Uint8List buf) { + static int write(MoqAudio value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += FfiConverterUInt64.write( - value.sequence, + new_offset += FfiConverterOptionalString.write( + value.label, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterOptionalUInt64.write( - value.timestampUs, + new_offset += FfiConverterOptionalString.write( + value.broadcast, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterUint8List.write( - value.payload, + new_offset += FfiConverterOptionalString.write( + value.track, Uint8List.view(buf.buffer, new_offset), ); - return new_offset - buf.offsetInBytes; - } - - static int allocationSize(MoqDatagram value) { - return FfiConverterUInt64.allocationSize(value.sequence) + - FfiConverterOptionalUInt64.allocationSize(value.timestampUs) + - FfiConverterUint8List.allocationSize(value.payload) + - 0; - } -} - -class MoqDimensions { - final int width; - final int height; - MoqDimensions({required this.width, required this.height}); -} - -class FfiConverterMoqDimensions { - static MoqDimensions lift(RustBuffer buf) { - return FfiConverterMoqDimensions.read(buf.asUint8List()).value; - } - - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final width_lifted = FfiConverterUInt32.read( + new_offset += FfiConverterString.write( + value.codec, Uint8List.view(buf.buffer, new_offset), ); - final width = width_lifted.value; - new_offset += width_lifted.bytesRead; - final height_lifted = FfiConverterUInt32.read( + new_offset += FfiConverterOptionalUint8List.write( + value.description, Uint8List.view(buf.buffer, new_offset), ); - final height = height_lifted.value; - new_offset += height_lifted.bytesRead; - return LiftRetVal( - MoqDimensions(width: width, height: height), - new_offset - buf.offsetInBytes, - ); - } - - static RustBuffer lower(MoqDimensions value) { - final total_length = - FfiConverterUInt32.allocationSize(value.width) + - FfiConverterUInt32.allocationSize(value.height) + - 0; - final buf = Uint8List(total_length); - write(value, buf); - return toRustBuffer(buf); - } - - static int write(MoqDimensions value, Uint8List buf) { - int new_offset = buf.offsetInBytes; new_offset += FfiConverterUInt32.write( - value.width, + value.sampleRate, Uint8List.view(buf.buffer, new_offset), ); new_offset += FfiConverterUInt32.write( - value.height, + value.channelCount, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalUInt64.write( + value.bitrate, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterBool.write( + value.enabled, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterMoqContainer.write( + value.container, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalUInt64.write( + value.jitterUs, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(MoqDimensions value) { - return FfiConverterUInt32.allocationSize(value.width) + - FfiConverterUInt32.allocationSize(value.height) + + static int allocationSize(MoqAudio value) { + return FfiConverterOptionalString.allocationSize(value.label) + + FfiConverterOptionalString.allocationSize(value.broadcast) + + FfiConverterOptionalString.allocationSize(value.track) + + FfiConverterString.allocationSize(value.codec) + + FfiConverterOptionalUint8List.allocationSize(value.description) + + FfiConverterUInt32.allocationSize(value.sampleRate) + + FfiConverterUInt32.allocationSize(value.channelCount) + + FfiConverterOptionalUInt64.allocationSize(value.bitrate) + + FfiConverterBool.allocationSize(value.enabled) + + FfiConverterMoqContainer.allocationSize(value.container) + + FfiConverterOptionalUInt64.allocationSize(value.jitterUs) + 0; } } -class MoqFrame { - final Uint8List payload; - final int? timestampUs; - MoqFrame({required this.payload, this.timestampUs = null}); +class MoqAudioInit { + final MoqAudioFormat format; + final Uint8List data; + final String? label; + MoqAudioInit({required this.format, required this.data, this.label = null}); } -class FfiConverterMoqFrame { - static MoqFrame lift(RustBuffer buf) { - return FfiConverterMoqFrame.read(buf.asUint8List()).value; +class FfiConverterMoqAudioInit { + static MoqAudioInit lift(RustBuffer buf) { + return FfiConverterMoqAudioInit.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final payload_lifted = FfiConverterUint8List.read( + final format_lifted = FfiConverterMoqAudioFormat.read( Uint8List.view(buf.buffer, new_offset), ); - final payload = payload_lifted.value; - new_offset += payload_lifted.bytesRead; - final timestampUs_lifted = FfiConverterOptionalUInt64.read( + final format = format_lifted.value; + new_offset += format_lifted.bytesRead; + final data_lifted = FfiConverterUint8List.read( Uint8List.view(buf.buffer, new_offset), ); - final timestampUs = timestampUs_lifted.value; - new_offset += timestampUs_lifted.bytesRead; + final data = data_lifted.value; + new_offset += data_lifted.bytesRead; + final label_lifted = FfiConverterOptionalString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final label = label_lifted.value; + new_offset += label_lifted.bytesRead; return LiftRetVal( - MoqFrame(payload: payload, timestampUs: timestampUs), + MoqAudioInit(format: format, data: data, label: label), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(MoqFrame value) { + static RustBuffer lower(MoqAudioInit value) { final total_length = - FfiConverterUint8List.allocationSize(value.payload) + - FfiConverterOptionalUInt64.allocationSize(value.timestampUs) + + FfiConverterMoqAudioFormat.allocationSize(value.format) + + FfiConverterUint8List.allocationSize(value.data) + + FfiConverterOptionalString.allocationSize(value.label) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(MoqFrame value, Uint8List buf) { + static int write(MoqAudioInit value, Uint8List buf) { int new_offset = buf.offsetInBytes; + new_offset += FfiConverterMoqAudioFormat.write( + value.format, + Uint8List.view(buf.buffer, new_offset), + ); new_offset += FfiConverterUint8List.write( - value.payload, + value.data, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterOptionalUInt64.write( - value.timestampUs, + new_offset += FfiConverterOptionalString.write( + value.label, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(MoqFrame value) { - return FfiConverterUint8List.allocationSize(value.payload) + - FfiConverterOptionalUInt64.allocationSize(value.timestampUs) + + static int allocationSize(MoqAudioInit value) { + return FfiConverterMoqAudioFormat.allocationSize(value.format) + + FfiConverterUint8List.allocationSize(value.data) + + FfiConverterOptionalString.allocationSize(value.label) + 0; } } -class MoqMediaFrame { - final Uint8List payload; - final int timestampUs; - final bool keyframe; - MoqMediaFrame({ - required this.payload, - required this.timestampUs, - required this.keyframe, +class MoqCatalog { + final Map video; + final Map audio; + final MoqDimensions? display; + final double? rotation; + final bool? flip; + final Map sections; + MoqCatalog({ + required this.video, + required this.audio, + this.display, + this.rotation, + this.flip, + required this.sections, }); } -class FfiConverterMoqMediaFrame { - static MoqMediaFrame lift(RustBuffer buf) { - return FfiConverterMoqMediaFrame.read(buf.asUint8List()).value; +class FfiConverterMoqCatalog { + static MoqCatalog lift(RustBuffer buf) { + return FfiConverterMoqCatalog.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final payload_lifted = FfiConverterUint8List.read( + final video_lifted = FfiConverterMapStringToMoqVideo.read( Uint8List.view(buf.buffer, new_offset), ); - final payload = payload_lifted.value; - new_offset += payload_lifted.bytesRead; - final timestampUs_lifted = FfiConverterUInt64.read( + final video = video_lifted.value; + new_offset += video_lifted.bytesRead; + final audio_lifted = FfiConverterMapStringToMoqAudio.read( Uint8List.view(buf.buffer, new_offset), ); - final timestampUs = timestampUs_lifted.value; - new_offset += timestampUs_lifted.bytesRead; - final keyframe_lifted = FfiConverterBool.read( + final audio = audio_lifted.value; + new_offset += audio_lifted.bytesRead; + final display_lifted = FfiConverterOptionalMoqDimensions.read( Uint8List.view(buf.buffer, new_offset), ); - final keyframe = keyframe_lifted.value; - new_offset += keyframe_lifted.bytesRead; + final display = display_lifted.value; + new_offset += display_lifted.bytesRead; + final rotation_lifted = FfiConverterOptionalDouble64.read( + Uint8List.view(buf.buffer, new_offset), + ); + final rotation = rotation_lifted.value; + new_offset += rotation_lifted.bytesRead; + final flip_lifted = FfiConverterOptionalBool.read( + Uint8List.view(buf.buffer, new_offset), + ); + final flip = flip_lifted.value; + new_offset += flip_lifted.bytesRead; + final sections_lifted = FfiConverterMapStringToString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final sections = sections_lifted.value; + new_offset += sections_lifted.bytesRead; return LiftRetVal( - MoqMediaFrame( - payload: payload, - timestampUs: timestampUs, - keyframe: keyframe, + MoqCatalog( + video: video, + audio: audio, + display: display, + rotation: rotation, + flip: flip, + sections: sections, ), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(MoqMediaFrame value) { + static RustBuffer lower(MoqCatalog value) { final total_length = - FfiConverterUint8List.allocationSize(value.payload) + - FfiConverterUInt64.allocationSize(value.timestampUs) + - FfiConverterBool.allocationSize(value.keyframe) + + FfiConverterMapStringToMoqVideo.allocationSize(value.video) + + FfiConverterMapStringToMoqAudio.allocationSize(value.audio) + + FfiConverterOptionalMoqDimensions.allocationSize(value.display) + + FfiConverterOptionalDouble64.allocationSize(value.rotation) + + FfiConverterOptionalBool.allocationSize(value.flip) + + FfiConverterMapStringToString.allocationSize(value.sections) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(MoqMediaFrame value, Uint8List buf) { + static int write(MoqCatalog value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += FfiConverterUint8List.write( - value.payload, + new_offset += FfiConverterMapStringToMoqVideo.write( + value.video, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterUInt64.write( - value.timestampUs, + new_offset += FfiConverterMapStringToMoqAudio.write( + value.audio, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterBool.write( - value.keyframe, + new_offset += FfiConverterOptionalMoqDimensions.write( + value.display, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalDouble64.write( + value.rotation, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalBool.write( + value.flip, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterMapStringToString.write( + value.sections, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(MoqMediaFrame value) { - return FfiConverterUint8List.allocationSize(value.payload) + - FfiConverterUInt64.allocationSize(value.timestampUs) + - FfiConverterBool.allocationSize(value.keyframe) + - 0; + static int allocationSize(MoqCatalog value) { + return FfiConverterMapStringToMoqVideo.allocationSize(value.video) + + FfiConverterMapStringToMoqAudio.allocationSize(value.audio) + + FfiConverterOptionalMoqDimensions.allocationSize(value.display) + + FfiConverterOptionalDouble64.allocationSize(value.rotation) + + FfiConverterOptionalBool.allocationSize(value.flip) + + FfiConverterMapStringToString.allocationSize(value.sections) + + 0; } } -class MoqMediaGroupConfig { - final MoqRendition rendition; - final int sequence; - final MoqFetchGroupOptions? options; - MoqMediaGroupConfig({ - required this.rendition, - required this.sequence, - this.options = null, +class MoqContainerInit { + final MoqContainerFormat format; + final Uint8List data; + final MoqMediaTimebase? timebase; + MoqContainerInit({ + required this.format, + required this.data, + this.timebase = null, }); } -class FfiConverterMoqMediaGroupConfig { - static MoqMediaGroupConfig lift(RustBuffer buf) { - return FfiConverterMoqMediaGroupConfig.read(buf.asUint8List()).value; +class FfiConverterMoqContainerInit { + static MoqContainerInit lift(RustBuffer buf) { + return FfiConverterMoqContainerInit.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final rendition_lifted = FfiConverterMoqRendition.read( + final format_lifted = FfiConverterMoqContainerFormat.read( Uint8List.view(buf.buffer, new_offset), ); - final rendition = rendition_lifted.value; - new_offset += rendition_lifted.bytesRead; - final sequence_lifted = FfiConverterUInt64.read( + final format = format_lifted.value; + new_offset += format_lifted.bytesRead; + final data_lifted = FfiConverterUint8List.read( Uint8List.view(buf.buffer, new_offset), ); - final sequence = sequence_lifted.value; - new_offset += sequence_lifted.bytesRead; - final options_lifted = FfiConverterOptionalMoqFetchGroupOptions.read( + final data = data_lifted.value; + new_offset += data_lifted.bytesRead; + final timebase_lifted = FfiConverterOptionalMoqMediaTimebase.read( Uint8List.view(buf.buffer, new_offset), ); - final options = options_lifted.value; - new_offset += options_lifted.bytesRead; + final timebase = timebase_lifted.value; + new_offset += timebase_lifted.bytesRead; return LiftRetVal( - MoqMediaGroupConfig( - rendition: rendition, - sequence: sequence, - options: options, - ), + MoqContainerInit(format: format, data: data, timebase: timebase), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(MoqMediaGroupConfig value) { + static RustBuffer lower(MoqContainerInit value) { final total_length = - FfiConverterMoqRendition.allocationSize(value.rendition) + - FfiConverterUInt64.allocationSize(value.sequence) + - FfiConverterOptionalMoqFetchGroupOptions.allocationSize(value.options) + + FfiConverterMoqContainerFormat.allocationSize(value.format) + + FfiConverterUint8List.allocationSize(value.data) + + FfiConverterOptionalMoqMediaTimebase.allocationSize(value.timebase) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(MoqMediaGroupConfig value, Uint8List buf) { + static int write(MoqContainerInit value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += FfiConverterMoqRendition.write( - value.rendition, + new_offset += FfiConverterMoqContainerFormat.write( + value.format, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterUInt64.write( - value.sequence, + new_offset += FfiConverterUint8List.write( + value.data, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterOptionalMoqFetchGroupOptions.write( - value.options, + new_offset += FfiConverterOptionalMoqMediaTimebase.write( + value.timebase, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(MoqMediaGroupConfig value) { - return FfiConverterMoqRendition.allocationSize(value.rendition) + - FfiConverterUInt64.allocationSize(value.sequence) + - FfiConverterOptionalMoqFetchGroupOptions.allocationSize(value.options) + + static int allocationSize(MoqContainerInit value) { + return FfiConverterMoqContainerFormat.allocationSize(value.format) + + FfiConverterUint8List.allocationSize(value.data) + + FfiConverterOptionalMoqMediaTimebase.allocationSize(value.timebase) + 0; } } -class MoqMediaTrackConfig { - final MoqRendition rendition; - final MoqSubscription? subscription; - MoqMediaTrackConfig({required this.rendition, this.subscription = null}); +class MoqContainerStreamInit { + final MoqContainerFormat format; + final MoqMediaTimebase? timebase; + MoqContainerStreamInit({required this.format, this.timebase = null}); } -class FfiConverterMoqMediaTrackConfig { - static MoqMediaTrackConfig lift(RustBuffer buf) { - return FfiConverterMoqMediaTrackConfig.read(buf.asUint8List()).value; +class FfiConverterMoqContainerStreamInit { + static MoqContainerStreamInit lift(RustBuffer buf) { + return FfiConverterMoqContainerStreamInit.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final rendition_lifted = FfiConverterMoqRendition.read( + final format_lifted = FfiConverterMoqContainerFormat.read( Uint8List.view(buf.buffer, new_offset), ); - final rendition = rendition_lifted.value; - new_offset += rendition_lifted.bytesRead; - final subscription_lifted = FfiConverterOptionalMoqSubscription.read( + final format = format_lifted.value; + new_offset += format_lifted.bytesRead; + final timebase_lifted = FfiConverterOptionalMoqMediaTimebase.read( Uint8List.view(buf.buffer, new_offset), ); - final subscription = subscription_lifted.value; - new_offset += subscription_lifted.bytesRead; + final timebase = timebase_lifted.value; + new_offset += timebase_lifted.bytesRead; return LiftRetVal( - MoqMediaTrackConfig(rendition: rendition, subscription: subscription), + MoqContainerStreamInit(format: format, timebase: timebase), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(MoqMediaTrackConfig value) { + static RustBuffer lower(MoqContainerStreamInit value) { final total_length = - FfiConverterMoqRendition.allocationSize(value.rendition) + - FfiConverterOptionalMoqSubscription.allocationSize(value.subscription) + + FfiConverterMoqContainerFormat.allocationSize(value.format) + + FfiConverterOptionalMoqMediaTimebase.allocationSize(value.timebase) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(MoqMediaTrackConfig value, Uint8List buf) { + static int write(MoqContainerStreamInit value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += FfiConverterMoqRendition.write( - value.rendition, + new_offset += FfiConverterMoqContainerFormat.write( + value.format, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterOptionalMoqSubscription.write( - value.subscription, + new_offset += FfiConverterOptionalMoqMediaTimebase.write( + value.timebase, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(MoqMediaTrackConfig value) { - return FfiConverterMoqRendition.allocationSize(value.rendition) + - FfiConverterOptionalMoqSubscription.allocationSize(value.subscription) + + static int allocationSize(MoqContainerStreamInit value) { + return FfiConverterMoqContainerFormat.allocationSize(value.format) + + FfiConverterOptionalMoqMediaTimebase.allocationSize(value.timebase) + 0; } } -class MoqVideo { - final String? label; - final String? broadcast; - final String? track; - final String codec; - final Uint8List? description; - final MoqDimensions? coded; - final MoqDimensions? displayAspect; - final int? bitrate; - final bool enabled; - final double? framerate; - final MoqContainer container; - MoqVideo({ - this.label = null, - this.broadcast = null, - this.track = null, - required this.codec, - this.description, - this.coded, - this.displayAspect, - this.bitrate, - this.enabled = true, - this.framerate, - required this.container, +class MoqDatagram { + final int sequence; + final int? timestampUs; + final Uint8List payload; + MoqDatagram({ + this.sequence = 0, + this.timestampUs = null, + required this.payload, }); } -class FfiConverterMoqVideo { - static MoqVideo lift(RustBuffer buf) { - return FfiConverterMoqVideo.read(buf.asUint8List()).value; +class FfiConverterMoqDatagram { + static MoqDatagram lift(RustBuffer buf) { + return FfiConverterMoqDatagram.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final label_lifted = FfiConverterOptionalString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final label = label_lifted.value; - new_offset += label_lifted.bytesRead; - final broadcast_lifted = FfiConverterOptionalString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final broadcast = broadcast_lifted.value; - new_offset += broadcast_lifted.bytesRead; - final track_lifted = FfiConverterOptionalString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final track = track_lifted.value; - new_offset += track_lifted.bytesRead; - final codec_lifted = FfiConverterString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final codec = codec_lifted.value; - new_offset += codec_lifted.bytesRead; - final description_lifted = FfiConverterOptionalUint8List.read( - Uint8List.view(buf.buffer, new_offset), - ); - final description = description_lifted.value; - new_offset += description_lifted.bytesRead; - final coded_lifted = FfiConverterOptionalMoqDimensions.read( - Uint8List.view(buf.buffer, new_offset), - ); - final coded = coded_lifted.value; - new_offset += coded_lifted.bytesRead; - final displayAspect_lifted = FfiConverterOptionalMoqDimensions.read( - Uint8List.view(buf.buffer, new_offset), - ); - final displayAspect = displayAspect_lifted.value; - new_offset += displayAspect_lifted.bytesRead; - final bitrate_lifted = FfiConverterOptionalUInt64.read( - Uint8List.view(buf.buffer, new_offset), - ); - final bitrate = bitrate_lifted.value; - new_offset += bitrate_lifted.bytesRead; - final enabled_lifted = FfiConverterBool.read( + final sequence_lifted = FfiConverterUInt64.read( Uint8List.view(buf.buffer, new_offset), ); - final enabled = enabled_lifted.value; - new_offset += enabled_lifted.bytesRead; - final framerate_lifted = FfiConverterOptionalDouble64.read( + final sequence = sequence_lifted.value; + new_offset += sequence_lifted.bytesRead; + final timestampUs_lifted = FfiConverterOptionalUInt64.read( Uint8List.view(buf.buffer, new_offset), ); - final framerate = framerate_lifted.value; - new_offset += framerate_lifted.bytesRead; - final container_lifted = FfiConverterMoqContainer.read( + final timestampUs = timestampUs_lifted.value; + new_offset += timestampUs_lifted.bytesRead; + final payload_lifted = FfiConverterUint8List.read( Uint8List.view(buf.buffer, new_offset), ); - final container = container_lifted.value; - new_offset += container_lifted.bytesRead; + final payload = payload_lifted.value; + new_offset += payload_lifted.bytesRead; return LiftRetVal( - MoqVideo( - label: label, - broadcast: broadcast, - track: track, - codec: codec, - description: description, - coded: coded, - displayAspect: displayAspect, - bitrate: bitrate, - enabled: enabled, - framerate: framerate, - container: container, + MoqDatagram( + sequence: sequence, + timestampUs: timestampUs, + payload: payload, ), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(MoqVideo value) { + static RustBuffer lower(MoqDatagram value) { final total_length = - FfiConverterOptionalString.allocationSize(value.label) + - FfiConverterOptionalString.allocationSize(value.broadcast) + - FfiConverterOptionalString.allocationSize(value.track) + - FfiConverterString.allocationSize(value.codec) + - FfiConverterOptionalUint8List.allocationSize(value.description) + - FfiConverterOptionalMoqDimensions.allocationSize(value.coded) + - FfiConverterOptionalMoqDimensions.allocationSize(value.displayAspect) + - FfiConverterOptionalUInt64.allocationSize(value.bitrate) + - FfiConverterBool.allocationSize(value.enabled) + - FfiConverterOptionalDouble64.allocationSize(value.framerate) + - FfiConverterMoqContainer.allocationSize(value.container) + + FfiConverterUInt64.allocationSize(value.sequence) + + FfiConverterOptionalUInt64.allocationSize(value.timestampUs) + + FfiConverterUint8List.allocationSize(value.payload) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(MoqVideo value, Uint8List buf) { + static int write(MoqDatagram value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += FfiConverterOptionalString.write( - value.label, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalString.write( - value.broadcast, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalString.write( - value.track, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterString.write( - value.codec, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalUint8List.write( - value.description, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalMoqDimensions.write( - value.coded, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalMoqDimensions.write( - value.displayAspect, + new_offset += FfiConverterUInt64.write( + value.sequence, Uint8List.view(buf.buffer, new_offset), ); new_offset += FfiConverterOptionalUInt64.write( - value.bitrate, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterBool.write( - value.enabled, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalDouble64.write( - value.framerate, + value.timestampUs, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterMoqContainer.write( - value.container, + new_offset += FfiConverterUint8List.write( + value.payload, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(MoqVideo value) { - return FfiConverterOptionalString.allocationSize(value.label) + - FfiConverterOptionalString.allocationSize(value.broadcast) + - FfiConverterOptionalString.allocationSize(value.track) + - FfiConverterString.allocationSize(value.codec) + - FfiConverterOptionalUint8List.allocationSize(value.description) + - FfiConverterOptionalMoqDimensions.allocationSize(value.coded) + - FfiConverterOptionalMoqDimensions.allocationSize(value.displayAspect) + - FfiConverterOptionalUInt64.allocationSize(value.bitrate) + - FfiConverterBool.allocationSize(value.enabled) + - FfiConverterOptionalDouble64.allocationSize(value.framerate) + - FfiConverterMoqContainer.allocationSize(value.container) + + static int allocationSize(MoqDatagram value) { + return FfiConverterUInt64.allocationSize(value.sequence) + + FfiConverterOptionalUInt64.allocationSize(value.timestampUs) + + FfiConverterUint8List.allocationSize(value.payload) + 0; } } -class MoqVideoHint { - final MoqDimensions? coded; - final MoqDimensions? displayAspect; - final int? bitrate; - final double? framerate; - final bool? optimizeForLatency; - MoqVideoHint({ - this.coded = null, - this.displayAspect = null, - this.bitrate = null, - this.framerate = null, - this.optimizeForLatency = null, - }); +class MoqDimensions { + final int width; + final int height; + MoqDimensions({required this.width, required this.height}); } -class FfiConverterMoqVideoHint { - static MoqVideoHint lift(RustBuffer buf) { - return FfiConverterMoqVideoHint.read(buf.asUint8List()).value; +class FfiConverterMoqDimensions { + static MoqDimensions lift(RustBuffer buf) { + return FfiConverterMoqDimensions.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final coded_lifted = FfiConverterOptionalMoqDimensions.read( - Uint8List.view(buf.buffer, new_offset), - ); - final coded = coded_lifted.value; - new_offset += coded_lifted.bytesRead; - final displayAspect_lifted = FfiConverterOptionalMoqDimensions.read( - Uint8List.view(buf.buffer, new_offset), - ); - final displayAspect = displayAspect_lifted.value; - new_offset += displayAspect_lifted.bytesRead; - final bitrate_lifted = FfiConverterOptionalUInt64.read( - Uint8List.view(buf.buffer, new_offset), - ); - final bitrate = bitrate_lifted.value; - new_offset += bitrate_lifted.bytesRead; - final framerate_lifted = FfiConverterOptionalDouble64.read( + final width_lifted = FfiConverterUInt32.read( Uint8List.view(buf.buffer, new_offset), ); - final framerate = framerate_lifted.value; - new_offset += framerate_lifted.bytesRead; - final optimizeForLatency_lifted = FfiConverterOptionalBool.read( + final width = width_lifted.value; + new_offset += width_lifted.bytesRead; + final height_lifted = FfiConverterUInt32.read( Uint8List.view(buf.buffer, new_offset), ); - final optimizeForLatency = optimizeForLatency_lifted.value; - new_offset += optimizeForLatency_lifted.bytesRead; + final height = height_lifted.value; + new_offset += height_lifted.bytesRead; return LiftRetVal( - MoqVideoHint( - coded: coded, - displayAspect: displayAspect, - bitrate: bitrate, - framerate: framerate, - optimizeForLatency: optimizeForLatency, - ), + MoqDimensions(width: width, height: height), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(MoqVideoHint value) { + static RustBuffer lower(MoqDimensions value) { final total_length = - FfiConverterOptionalMoqDimensions.allocationSize(value.coded) + - FfiConverterOptionalMoqDimensions.allocationSize(value.displayAspect) + - FfiConverterOptionalUInt64.allocationSize(value.bitrate) + - FfiConverterOptionalDouble64.allocationSize(value.framerate) + - FfiConverterOptionalBool.allocationSize(value.optimizeForLatency) + + FfiConverterUInt32.allocationSize(value.width) + + FfiConverterUInt32.allocationSize(value.height) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(MoqVideoHint value, Uint8List buf) { + static int write(MoqDimensions value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += FfiConverterOptionalMoqDimensions.write( - value.coded, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalMoqDimensions.write( - value.displayAspect, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalUInt64.write( - value.bitrate, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalDouble64.write( - value.framerate, + new_offset += FfiConverterUInt32.write( + value.width, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterOptionalBool.write( - value.optimizeForLatency, + new_offset += FfiConverterUInt32.write( + value.height, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(MoqVideoHint value) { - return FfiConverterOptionalMoqDimensions.allocationSize(value.coded) + - FfiConverterOptionalMoqDimensions.allocationSize(value.displayAspect) + - FfiConverterOptionalUInt64.allocationSize(value.bitrate) + - FfiConverterOptionalDouble64.allocationSize(value.framerate) + - FfiConverterOptionalBool.allocationSize(value.optimizeForLatency) + + static int allocationSize(MoqDimensions value) { + return FfiConverterUInt32.allocationSize(value.width) + + FfiConverterUInt32.allocationSize(value.height) + 0; } } -class MoqVideoInit { - final MoqVideoFormat format; - final Uint8List data; - final String? label; - final MoqVideoHint? hint; - MoqVideoInit({ - required this.format, - required this.data, - this.label = null, - this.hint = null, - }); +class MoqFrame { + final Uint8List payload; + final int? timestampUs; + MoqFrame({required this.payload, this.timestampUs = null}); } -class FfiConverterMoqVideoInit { - static MoqVideoInit lift(RustBuffer buf) { - return FfiConverterMoqVideoInit.read(buf.asUint8List()).value; +class FfiConverterMoqFrame { + static MoqFrame lift(RustBuffer buf) { + return FfiConverterMoqFrame.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final format_lifted = FfiConverterMoqVideoFormat.read( - Uint8List.view(buf.buffer, new_offset), - ); - final format = format_lifted.value; - new_offset += format_lifted.bytesRead; - final data_lifted = FfiConverterUint8List.read( - Uint8List.view(buf.buffer, new_offset), - ); - final data = data_lifted.value; - new_offset += data_lifted.bytesRead; - final label_lifted = FfiConverterOptionalString.read( + final payload_lifted = FfiConverterUint8List.read( Uint8List.view(buf.buffer, new_offset), ); - final label = label_lifted.value; - new_offset += label_lifted.bytesRead; - final hint_lifted = FfiConverterOptionalMoqVideoHint.read( + final payload = payload_lifted.value; + new_offset += payload_lifted.bytesRead; + final timestampUs_lifted = FfiConverterOptionalUInt64.read( Uint8List.view(buf.buffer, new_offset), ); - final hint = hint_lifted.value; - new_offset += hint_lifted.bytesRead; + final timestampUs = timestampUs_lifted.value; + new_offset += timestampUs_lifted.bytesRead; return LiftRetVal( - MoqVideoInit(format: format, data: data, label: label, hint: hint), + MoqFrame(payload: payload, timestampUs: timestampUs), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(MoqVideoInit value) { + static RustBuffer lower(MoqFrame value) { final total_length = - FfiConverterMoqVideoFormat.allocationSize(value.format) + - FfiConverterUint8List.allocationSize(value.data) + - FfiConverterOptionalString.allocationSize(value.label) + - FfiConverterOptionalMoqVideoHint.allocationSize(value.hint) + + FfiConverterUint8List.allocationSize(value.payload) + + FfiConverterOptionalUInt64.allocationSize(value.timestampUs) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(MoqVideoInit value, Uint8List buf) { + static int write(MoqFrame value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += FfiConverterMoqVideoFormat.write( - value.format, - Uint8List.view(buf.buffer, new_offset), - ); new_offset += FfiConverterUint8List.write( - value.data, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalString.write( - value.label, + value.payload, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterOptionalMoqVideoHint.write( - value.hint, + new_offset += FfiConverterOptionalUInt64.write( + value.timestampUs, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(MoqVideoInit value) { - return FfiConverterMoqVideoFormat.allocationSize(value.format) + - FfiConverterUint8List.allocationSize(value.data) + - FfiConverterOptionalString.allocationSize(value.label) + - FfiConverterOptionalMoqVideoHint.allocationSize(value.hint) + + static int allocationSize(MoqFrame value) { + return FfiConverterUint8List.allocationSize(value.payload) + + FfiConverterOptionalUInt64.allocationSize(value.timestampUs) + 0; } } -class MoqVideoProperties { - final MoqDimensions? display; - final double? rotation; - final bool? flip; - MoqVideoProperties({ - this.display = null, - this.rotation = null, - this.flip = null, +class MoqMediaFrame { + final Uint8List payload; + final int timestampUs; + final bool keyframe; + MoqMediaFrame({ + required this.payload, + required this.timestampUs, + required this.keyframe, }); } -class FfiConverterMoqVideoProperties { - static MoqVideoProperties lift(RustBuffer buf) { - return FfiConverterMoqVideoProperties.read(buf.asUint8List()).value; +class FfiConverterMoqMediaFrame { + static MoqMediaFrame lift(RustBuffer buf) { + return FfiConverterMoqMediaFrame.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final display_lifted = FfiConverterOptionalMoqDimensions.read( + final payload_lifted = FfiConverterUint8List.read( Uint8List.view(buf.buffer, new_offset), ); - final display = display_lifted.value; - new_offset += display_lifted.bytesRead; - final rotation_lifted = FfiConverterOptionalDouble64.read( + final payload = payload_lifted.value; + new_offset += payload_lifted.bytesRead; + final timestampUs_lifted = FfiConverterUInt64.read( Uint8List.view(buf.buffer, new_offset), ); - final rotation = rotation_lifted.value; - new_offset += rotation_lifted.bytesRead; - final flip_lifted = FfiConverterOptionalBool.read( + final timestampUs = timestampUs_lifted.value; + new_offset += timestampUs_lifted.bytesRead; + final keyframe_lifted = FfiConverterBool.read( Uint8List.view(buf.buffer, new_offset), ); - final flip = flip_lifted.value; - new_offset += flip_lifted.bytesRead; + final keyframe = keyframe_lifted.value; + new_offset += keyframe_lifted.bytesRead; return LiftRetVal( - MoqVideoProperties(display: display, rotation: rotation, flip: flip), + MoqMediaFrame( + payload: payload, + timestampUs: timestampUs, + keyframe: keyframe, + ), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(MoqVideoProperties value) { + static RustBuffer lower(MoqMediaFrame value) { final total_length = - FfiConverterOptionalMoqDimensions.allocationSize(value.display) + - FfiConverterOptionalDouble64.allocationSize(value.rotation) + - FfiConverterOptionalBool.allocationSize(value.flip) + + FfiConverterUint8List.allocationSize(value.payload) + + FfiConverterUInt64.allocationSize(value.timestampUs) + + FfiConverterBool.allocationSize(value.keyframe) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(MoqVideoProperties value, Uint8List buf) { + static int write(MoqMediaFrame value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += FfiConverterOptionalMoqDimensions.write( - value.display, + new_offset += FfiConverterUint8List.write( + value.payload, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterOptionalDouble64.write( - value.rotation, + new_offset += FfiConverterUInt64.write( + value.timestampUs, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterOptionalBool.write( - value.flip, + new_offset += FfiConverterBool.write( + value.keyframe, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(MoqVideoProperties value) { - return FfiConverterOptionalMoqDimensions.allocationSize(value.display) + - FfiConverterOptionalDouble64.allocationSize(value.rotation) + - FfiConverterOptionalBool.allocationSize(value.flip) + + static int allocationSize(MoqMediaFrame value) { + return FfiConverterUint8List.allocationSize(value.payload) + + FfiConverterUInt64.allocationSize(value.timestampUs) + + FfiConverterBool.allocationSize(value.keyframe) + 0; } } -class MoqAnnounce { - final String prefix; - final List? captures; - final MoqRoute route; - MoqAnnounce({required this.prefix, this.captures, required this.route}); +class MoqMediaGroupConfig { + final MoqRendition rendition; + final int sequence; + final MoqFetchGroupOptions? options; + MoqMediaGroupConfig({ + required this.rendition, + required this.sequence, + this.options = null, + }); } -class FfiConverterMoqAnnounce { - static MoqAnnounce lift(RustBuffer buf) { - return FfiConverterMoqAnnounce.read(buf.asUint8List()).value; +class FfiConverterMoqMediaGroupConfig { + static MoqMediaGroupConfig lift(RustBuffer buf) { + return FfiConverterMoqMediaGroupConfig.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final prefix_lifted = FfiConverterString.read( + final rendition_lifted = FfiConverterMoqRendition.read( Uint8List.view(buf.buffer, new_offset), ); - final prefix = prefix_lifted.value; - new_offset += prefix_lifted.bytesRead; - final captures_lifted = FfiConverterOptionalSequenceString.read( + final rendition = rendition_lifted.value; + new_offset += rendition_lifted.bytesRead; + final sequence_lifted = FfiConverterUInt64.read( Uint8List.view(buf.buffer, new_offset), ); - final captures = captures_lifted.value; - new_offset += captures_lifted.bytesRead; - final route_lifted = FfiConverterMoqRoute.read( + final sequence = sequence_lifted.value; + new_offset += sequence_lifted.bytesRead; + final options_lifted = FfiConverterOptionalMoqFetchGroupOptions.read( Uint8List.view(buf.buffer, new_offset), ); - final route = route_lifted.value; - new_offset += route_lifted.bytesRead; + final options = options_lifted.value; + new_offset += options_lifted.bytesRead; return LiftRetVal( - MoqAnnounce(prefix: prefix, captures: captures, route: route), + MoqMediaGroupConfig( + rendition: rendition, + sequence: sequence, + options: options, + ), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(MoqAnnounce value) { + static RustBuffer lower(MoqMediaGroupConfig value) { final total_length = - FfiConverterString.allocationSize(value.prefix) + - FfiConverterOptionalSequenceString.allocationSize(value.captures) + - FfiConverterMoqRoute.allocationSize(value.route) + + FfiConverterMoqRendition.allocationSize(value.rendition) + + FfiConverterUInt64.allocationSize(value.sequence) + + FfiConverterOptionalMoqFetchGroupOptions.allocationSize(value.options) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(MoqAnnounce value, Uint8List buf) { + static int write(MoqMediaGroupConfig value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += FfiConverterString.write( - value.prefix, + new_offset += FfiConverterMoqRendition.write( + value.rendition, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterOptionalSequenceString.write( - value.captures, + new_offset += FfiConverterUInt64.write( + value.sequence, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterMoqRoute.write( - value.route, + new_offset += FfiConverterOptionalMoqFetchGroupOptions.write( + value.options, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(MoqAnnounce value) { - return FfiConverterString.allocationSize(value.prefix) + - FfiConverterOptionalSequenceString.allocationSize(value.captures) + - FfiConverterMoqRoute.allocationSize(value.route) + + static int allocationSize(MoqMediaGroupConfig value) { + return FfiConverterMoqRendition.allocationSize(value.rendition) + + FfiConverterUInt64.allocationSize(value.sequence) + + FfiConverterOptionalMoqFetchGroupOptions.allocationSize(value.options) + 0; } } -class MoqAnnounceConfig { - final String prefix; - final String? filter; - final bool hidden; - MoqAnnounceConfig({ - this.prefix = '', - this.filter = null, - this.hidden = false, - }); +class MoqMediaTrackConfig { + final MoqRendition rendition; + final MoqSubscription? subscription; + MoqMediaTrackConfig({required this.rendition, this.subscription = null}); } -class FfiConverterMoqAnnounceConfig { - static MoqAnnounceConfig lift(RustBuffer buf) { - return FfiConverterMoqAnnounceConfig.read(buf.asUint8List()).value; +class FfiConverterMoqMediaTrackConfig { + static MoqMediaTrackConfig lift(RustBuffer buf) { + return FfiConverterMoqMediaTrackConfig.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final prefix_lifted = FfiConverterString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final prefix = prefix_lifted.value; - new_offset += prefix_lifted.bytesRead; - final filter_lifted = FfiConverterOptionalString.read( + final rendition_lifted = FfiConverterMoqRendition.read( Uint8List.view(buf.buffer, new_offset), ); - final filter = filter_lifted.value; - new_offset += filter_lifted.bytesRead; - final hidden_lifted = FfiConverterBool.read( + final rendition = rendition_lifted.value; + new_offset += rendition_lifted.bytesRead; + final subscription_lifted = FfiConverterOptionalMoqSubscription.read( Uint8List.view(buf.buffer, new_offset), ); - final hidden = hidden_lifted.value; - new_offset += hidden_lifted.bytesRead; + final subscription = subscription_lifted.value; + new_offset += subscription_lifted.bytesRead; return LiftRetVal( - MoqAnnounceConfig(prefix: prefix, filter: filter, hidden: hidden), + MoqMediaTrackConfig(rendition: rendition, subscription: subscription), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(MoqAnnounceConfig value) { + static RustBuffer lower(MoqMediaTrackConfig value) { final total_length = - FfiConverterString.allocationSize(value.prefix) + - FfiConverterOptionalString.allocationSize(value.filter) + - FfiConverterBool.allocationSize(value.hidden) + + FfiConverterMoqRendition.allocationSize(value.rendition) + + FfiConverterOptionalMoqSubscription.allocationSize(value.subscription) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(MoqAnnounceConfig value, Uint8List buf) { + static int write(MoqMediaTrackConfig value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += FfiConverterString.write( - value.prefix, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalString.write( - value.filter, + new_offset += FfiConverterMoqRendition.write( + value.rendition, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterBool.write( - value.hidden, + new_offset += FfiConverterOptionalMoqSubscription.write( + value.subscription, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(MoqAnnounceConfig value) { - return FfiConverterString.allocationSize(value.prefix) + - FfiConverterOptionalString.allocationSize(value.filter) + - FfiConverterBool.allocationSize(value.hidden) + + static int allocationSize(MoqMediaTrackConfig value) { + return FfiConverterMoqRendition.allocationSize(value.rendition) + + FfiConverterOptionalMoqSubscription.allocationSize(value.subscription) + 0; } } -class MoqOriginConfig { - final int? cacheCapacityBytes; - MoqOriginConfig({this.cacheCapacityBytes = null}); +class MoqVideo { + final String? label; + final String? broadcast; + final String? track; + final String codec; + final Uint8List? description; + final MoqDimensions? coded; + final MoqDimensions? displayAspect; + final int? bitrate; + final bool enabled; + final double? framerate; + final MoqContainer container; + MoqVideo({ + this.label = null, + this.broadcast = null, + this.track = null, + required this.codec, + this.description, + this.coded, + this.displayAspect, + this.bitrate, + this.enabled = true, + this.framerate, + required this.container, + }); } -class FfiConverterMoqOriginConfig { - static MoqOriginConfig lift(RustBuffer buf) { - return FfiConverterMoqOriginConfig.read(buf.asUint8List()).value; +class FfiConverterMoqVideo { + static MoqVideo lift(RustBuffer buf) { + return FfiConverterMoqVideo.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final cacheCapacityBytes_lifted = FfiConverterOptionalUInt64.read( + final label_lifted = FfiConverterOptionalString.read( Uint8List.view(buf.buffer, new_offset), ); - final cacheCapacityBytes = cacheCapacityBytes_lifted.value; - new_offset += cacheCapacityBytes_lifted.bytesRead; + final label = label_lifted.value; + new_offset += label_lifted.bytesRead; + final broadcast_lifted = FfiConverterOptionalString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final broadcast = broadcast_lifted.value; + new_offset += broadcast_lifted.bytesRead; + final track_lifted = FfiConverterOptionalString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final track = track_lifted.value; + new_offset += track_lifted.bytesRead; + final codec_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final codec = codec_lifted.value; + new_offset += codec_lifted.bytesRead; + final description_lifted = FfiConverterOptionalUint8List.read( + Uint8List.view(buf.buffer, new_offset), + ); + final description = description_lifted.value; + new_offset += description_lifted.bytesRead; + final coded_lifted = FfiConverterOptionalMoqDimensions.read( + Uint8List.view(buf.buffer, new_offset), + ); + final coded = coded_lifted.value; + new_offset += coded_lifted.bytesRead; + final displayAspect_lifted = FfiConverterOptionalMoqDimensions.read( + Uint8List.view(buf.buffer, new_offset), + ); + final displayAspect = displayAspect_lifted.value; + new_offset += displayAspect_lifted.bytesRead; + final bitrate_lifted = FfiConverterOptionalUInt64.read( + Uint8List.view(buf.buffer, new_offset), + ); + final bitrate = bitrate_lifted.value; + new_offset += bitrate_lifted.bytesRead; + final enabled_lifted = FfiConverterBool.read( + Uint8List.view(buf.buffer, new_offset), + ); + final enabled = enabled_lifted.value; + new_offset += enabled_lifted.bytesRead; + final framerate_lifted = FfiConverterOptionalDouble64.read( + Uint8List.view(buf.buffer, new_offset), + ); + final framerate = framerate_lifted.value; + new_offset += framerate_lifted.bytesRead; + final container_lifted = FfiConverterMoqContainer.read( + Uint8List.view(buf.buffer, new_offset), + ); + final container = container_lifted.value; + new_offset += container_lifted.bytesRead; return LiftRetVal( - MoqOriginConfig(cacheCapacityBytes: cacheCapacityBytes), + MoqVideo( + label: label, + broadcast: broadcast, + track: track, + codec: codec, + description: description, + coded: coded, + displayAspect: displayAspect, + bitrate: bitrate, + enabled: enabled, + framerate: framerate, + container: container, + ), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(MoqOriginConfig value) { + static RustBuffer lower(MoqVideo value) { final total_length = - FfiConverterOptionalUInt64.allocationSize(value.cacheCapacityBytes) + 0; + FfiConverterOptionalString.allocationSize(value.label) + + FfiConverterOptionalString.allocationSize(value.broadcast) + + FfiConverterOptionalString.allocationSize(value.track) + + FfiConverterString.allocationSize(value.codec) + + FfiConverterOptionalUint8List.allocationSize(value.description) + + FfiConverterOptionalMoqDimensions.allocationSize(value.coded) + + FfiConverterOptionalMoqDimensions.allocationSize(value.displayAspect) + + FfiConverterOptionalUInt64.allocationSize(value.bitrate) + + FfiConverterBool.allocationSize(value.enabled) + + FfiConverterOptionalDouble64.allocationSize(value.framerate) + + FfiConverterMoqContainer.allocationSize(value.container) + + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(MoqOriginConfig value, Uint8List buf) { + static int write(MoqVideo value, Uint8List buf) { int new_offset = buf.offsetInBytes; + new_offset += FfiConverterOptionalString.write( + value.label, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalString.write( + value.broadcast, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalString.write( + value.track, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterString.write( + value.codec, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalUint8List.write( + value.description, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalMoqDimensions.write( + value.coded, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalMoqDimensions.write( + value.displayAspect, + Uint8List.view(buf.buffer, new_offset), + ); new_offset += FfiConverterOptionalUInt64.write( - value.cacheCapacityBytes, + value.bitrate, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterBool.write( + value.enabled, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalDouble64.write( + value.framerate, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterMoqContainer.write( + value.container, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(MoqOriginConfig value) { - return FfiConverterOptionalUInt64.allocationSize(value.cacheCapacityBytes) + + static int allocationSize(MoqVideo value) { + return FfiConverterOptionalString.allocationSize(value.label) + + FfiConverterOptionalString.allocationSize(value.broadcast) + + FfiConverterOptionalString.allocationSize(value.track) + + FfiConverterString.allocationSize(value.codec) + + FfiConverterOptionalUint8List.allocationSize(value.description) + + FfiConverterOptionalMoqDimensions.allocationSize(value.coded) + + FfiConverterOptionalMoqDimensions.allocationSize(value.displayAspect) + + FfiConverterOptionalUInt64.allocationSize(value.bitrate) + + FfiConverterBool.allocationSize(value.enabled) + + FfiConverterOptionalDouble64.allocationSize(value.framerate) + + FfiConverterMoqContainer.allocationSize(value.container) + 0; } } -class MoqRoute { - final List hops; - final int cost; - final bool anonymous; - final String? epoch; - MoqRoute({ - this.hops = const [], - this.cost = 0, - this.anonymous = false, - this.epoch = null, +class MoqVideoHint { + final MoqDimensions? coded; + final MoqDimensions? displayAspect; + final int? bitrate; + final double? framerate; + final bool? optimizeForLatency; + MoqVideoHint({ + this.coded = null, + this.displayAspect = null, + this.bitrate = null, + this.framerate = null, + this.optimizeForLatency = null, }); } -class FfiConverterMoqRoute { - static MoqRoute lift(RustBuffer buf) { - return FfiConverterMoqRoute.read(buf.asUint8List()).value; +class FfiConverterMoqVideoHint { + static MoqVideoHint lift(RustBuffer buf) { + return FfiConverterMoqVideoHint.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final hops_lifted = FfiConverterSequenceUInt64.read( + final coded_lifted = FfiConverterOptionalMoqDimensions.read( Uint8List.view(buf.buffer, new_offset), ); - final hops = hops_lifted.value; - new_offset += hops_lifted.bytesRead; - final cost_lifted = FfiConverterUInt64.read( + final coded = coded_lifted.value; + new_offset += coded_lifted.bytesRead; + final displayAspect_lifted = FfiConverterOptionalMoqDimensions.read( Uint8List.view(buf.buffer, new_offset), ); - final cost = cost_lifted.value; - new_offset += cost_lifted.bytesRead; - final anonymous_lifted = FfiConverterBool.read( + final displayAspect = displayAspect_lifted.value; + new_offset += displayAspect_lifted.bytesRead; + final bitrate_lifted = FfiConverterOptionalUInt64.read( Uint8List.view(buf.buffer, new_offset), ); - final anonymous = anonymous_lifted.value; - new_offset += anonymous_lifted.bytesRead; - final epoch_lifted = FfiConverterOptionalString.read( + final bitrate = bitrate_lifted.value; + new_offset += bitrate_lifted.bytesRead; + final framerate_lifted = FfiConverterOptionalDouble64.read( Uint8List.view(buf.buffer, new_offset), ); - final epoch = epoch_lifted.value; - new_offset += epoch_lifted.bytesRead; + final framerate = framerate_lifted.value; + new_offset += framerate_lifted.bytesRead; + final optimizeForLatency_lifted = FfiConverterOptionalBool.read( + Uint8List.view(buf.buffer, new_offset), + ); + final optimizeForLatency = optimizeForLatency_lifted.value; + new_offset += optimizeForLatency_lifted.bytesRead; return LiftRetVal( - MoqRoute(hops: hops, cost: cost, anonymous: anonymous, epoch: epoch), + MoqVideoHint( + coded: coded, + displayAspect: displayAspect, + bitrate: bitrate, + framerate: framerate, + optimizeForLatency: optimizeForLatency, + ), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(MoqRoute value) { + static RustBuffer lower(MoqVideoHint value) { final total_length = - FfiConverterSequenceUInt64.allocationSize(value.hops) + - FfiConverterUInt64.allocationSize(value.cost) + - FfiConverterBool.allocationSize(value.anonymous) + - FfiConverterOptionalString.allocationSize(value.epoch) + + FfiConverterOptionalMoqDimensions.allocationSize(value.coded) + + FfiConverterOptionalMoqDimensions.allocationSize(value.displayAspect) + + FfiConverterOptionalUInt64.allocationSize(value.bitrate) + + FfiConverterOptionalDouble64.allocationSize(value.framerate) + + FfiConverterOptionalBool.allocationSize(value.optimizeForLatency) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(MoqRoute value, Uint8List buf) { + static int write(MoqVideoHint value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += FfiConverterSequenceUInt64.write( - value.hops, + new_offset += FfiConverterOptionalMoqDimensions.write( + value.coded, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterUInt64.write( - value.cost, + new_offset += FfiConverterOptionalMoqDimensions.write( + value.displayAspect, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterBool.write( - value.anonymous, + new_offset += FfiConverterOptionalUInt64.write( + value.bitrate, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterOptionalString.write( - value.epoch, + new_offset += FfiConverterOptionalDouble64.write( + value.framerate, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalBool.write( + value.optimizeForLatency, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(MoqRoute value) { - return FfiConverterSequenceUInt64.allocationSize(value.hops) + - FfiConverterUInt64.allocationSize(value.cost) + - FfiConverterBool.allocationSize(value.anonymous) + - FfiConverterOptionalString.allocationSize(value.epoch) + + static int allocationSize(MoqVideoHint value) { + return FfiConverterOptionalMoqDimensions.allocationSize(value.coded) + + FfiConverterOptionalMoqDimensions.allocationSize(value.displayAspect) + + FfiConverterOptionalUInt64.allocationSize(value.bitrate) + + FfiConverterOptionalDouble64.allocationSize(value.framerate) + + FfiConverterOptionalBool.allocationSize(value.optimizeForLatency) + 0; } } -class MoqTrackInfo { - final int priority; - final int? maxAgeUs; - final int? timescale; - MoqTrackInfo({ - this.priority = 127, - this.maxAgeUs = null, - this.timescale = null, +class MoqVideoInit { + final MoqVideoFormat format; + final Uint8List data; + final String? label; + final MoqVideoHint? hint; + MoqVideoInit({ + required this.format, + required this.data, + this.label = null, + this.hint = null, }); } -class FfiConverterMoqTrackInfo { - static MoqTrackInfo lift(RustBuffer buf) { - return FfiConverterMoqTrackInfo.read(buf.asUint8List()).value; +class FfiConverterMoqVideoInit { + static MoqVideoInit lift(RustBuffer buf) { + return FfiConverterMoqVideoInit.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final priority_lifted = FfiConverterUInt8.read( + final format_lifted = FfiConverterMoqVideoFormat.read( Uint8List.view(buf.buffer, new_offset), ); - final priority = priority_lifted.value; - new_offset += priority_lifted.bytesRead; - final maxAgeUs_lifted = FfiConverterOptionalUInt64.read( + final format = format_lifted.value; + new_offset += format_lifted.bytesRead; + final data_lifted = FfiConverterUint8List.read( Uint8List.view(buf.buffer, new_offset), ); - final maxAgeUs = maxAgeUs_lifted.value; - new_offset += maxAgeUs_lifted.bytesRead; - final timescale_lifted = FfiConverterOptionalUInt64.read( + final data = data_lifted.value; + new_offset += data_lifted.bytesRead; + final label_lifted = FfiConverterOptionalString.read( Uint8List.view(buf.buffer, new_offset), ); - final timescale = timescale_lifted.value; - new_offset += timescale_lifted.bytesRead; + final label = label_lifted.value; + new_offset += label_lifted.bytesRead; + final hint_lifted = FfiConverterOptionalMoqVideoHint.read( + Uint8List.view(buf.buffer, new_offset), + ); + final hint = hint_lifted.value; + new_offset += hint_lifted.bytesRead; return LiftRetVal( - MoqTrackInfo( - priority: priority, - maxAgeUs: maxAgeUs, - timescale: timescale, - ), + MoqVideoInit(format: format, data: data, label: label, hint: hint), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(MoqTrackInfo value) { + static RustBuffer lower(MoqVideoInit value) { final total_length = - FfiConverterUInt8.allocationSize(value.priority) + - FfiConverterOptionalUInt64.allocationSize(value.maxAgeUs) + - FfiConverterOptionalUInt64.allocationSize(value.timescale) + + FfiConverterMoqVideoFormat.allocationSize(value.format) + + FfiConverterUint8List.allocationSize(value.data) + + FfiConverterOptionalString.allocationSize(value.label) + + FfiConverterOptionalMoqVideoHint.allocationSize(value.hint) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(MoqTrackInfo value, Uint8List buf) { + static int write(MoqVideoInit value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += FfiConverterUInt8.write( - value.priority, + new_offset += FfiConverterMoqVideoFormat.write( + value.format, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterOptionalUInt64.write( - value.maxAgeUs, + new_offset += FfiConverterUint8List.write( + value.data, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterOptionalUInt64.write( - value.timescale, + new_offset += FfiConverterOptionalString.write( + value.label, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalMoqVideoHint.write( + value.hint, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(MoqTrackInfo value) { - return FfiConverterUInt8.allocationSize(value.priority) + - FfiConverterOptionalUInt64.allocationSize(value.maxAgeUs) + - FfiConverterOptionalUInt64.allocationSize(value.timescale) + + static int allocationSize(MoqVideoInit value) { + return FfiConverterMoqVideoFormat.allocationSize(value.format) + + FfiConverterUint8List.allocationSize(value.data) + + FfiConverterOptionalString.allocationSize(value.label) + + FfiConverterOptionalMoqVideoHint.allocationSize(value.hint) + 0; } } -class MoqServerConfig { - final String? bind; - final List versions; - final MoqServerTls tls; - final MoqQuicConfig quic; - final MoqOriginProducer? publish; - final MoqOriginProducer? consume; - MoqServerConfig({ - this.bind = null, - this.versions = const [], - required this.tls, - required this.quic, - this.publish = null, - this.consume = null, +class MoqVideoProperties { + final MoqDimensions? display; + final double? rotation; + final bool? flip; + MoqVideoProperties({ + this.display = null, + this.rotation = null, + this.flip = null, }); } -class FfiConverterMoqServerConfig { - static MoqServerConfig lift(RustBuffer buf) { - return FfiConverterMoqServerConfig.read(buf.asUint8List()).value; +class FfiConverterMoqVideoProperties { + static MoqVideoProperties lift(RustBuffer buf) { + return FfiConverterMoqVideoProperties.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final bind_lifted = FfiConverterOptionalString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final bind = bind_lifted.value; - new_offset += bind_lifted.bytesRead; - final versions_lifted = FfiConverterSequenceString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final versions = versions_lifted.value; - new_offset += versions_lifted.bytesRead; - final tls_lifted = FfiConverterMoqServerTls.read( - Uint8List.view(buf.buffer, new_offset), - ); - final tls = tls_lifted.value; - new_offset += tls_lifted.bytesRead; - final quic_lifted = FfiConverterMoqQuicConfig.read( + final display_lifted = FfiConverterOptionalMoqDimensions.read( Uint8List.view(buf.buffer, new_offset), ); - final quic = quic_lifted.value; - new_offset += quic_lifted.bytesRead; - final publish_lifted = FfiConverterOptionalMoqOriginProducer.read( + final display = display_lifted.value; + new_offset += display_lifted.bytesRead; + final rotation_lifted = FfiConverterOptionalDouble64.read( Uint8List.view(buf.buffer, new_offset), ); - final publish = publish_lifted.value; - new_offset += publish_lifted.bytesRead; - final consume_lifted = FfiConverterOptionalMoqOriginProducer.read( + final rotation = rotation_lifted.value; + new_offset += rotation_lifted.bytesRead; + final flip_lifted = FfiConverterOptionalBool.read( Uint8List.view(buf.buffer, new_offset), ); - final consume = consume_lifted.value; - new_offset += consume_lifted.bytesRead; + final flip = flip_lifted.value; + new_offset += flip_lifted.bytesRead; return LiftRetVal( - MoqServerConfig( - bind: bind, - versions: versions, - tls: tls, - quic: quic, - publish: publish, - consume: consume, - ), + MoqVideoProperties(display: display, rotation: rotation, flip: flip), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(MoqServerConfig value) { + static RustBuffer lower(MoqVideoProperties value) { final total_length = - FfiConverterOptionalString.allocationSize(value.bind) + - FfiConverterSequenceString.allocationSize(value.versions) + - FfiConverterMoqServerTls.allocationSize(value.tls) + - FfiConverterMoqQuicConfig.allocationSize(value.quic) + - FfiConverterOptionalMoqOriginProducer.allocationSize(value.publish) + - FfiConverterOptionalMoqOriginProducer.allocationSize(value.consume) + + FfiConverterOptionalMoqDimensions.allocationSize(value.display) + + FfiConverterOptionalDouble64.allocationSize(value.rotation) + + FfiConverterOptionalBool.allocationSize(value.flip) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(MoqServerConfig value, Uint8List buf) { + static int write(MoqVideoProperties value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += FfiConverterOptionalString.write( - value.bind, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterSequenceString.write( - value.versions, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterMoqServerTls.write( - value.tls, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterMoqQuicConfig.write( - value.quic, + new_offset += FfiConverterOptionalMoqDimensions.write( + value.display, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterOptionalMoqOriginProducer.write( - value.publish, + new_offset += FfiConverterOptionalDouble64.write( + value.rotation, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterOptionalMoqOriginProducer.write( - value.consume, + new_offset += FfiConverterOptionalBool.write( + value.flip, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(MoqServerConfig value) { - return FfiConverterOptionalString.allocationSize(value.bind) + - FfiConverterSequenceString.allocationSize(value.versions) + - FfiConverterMoqServerTls.allocationSize(value.tls) + - FfiConverterMoqQuicConfig.allocationSize(value.quic) + - FfiConverterOptionalMoqOriginProducer.allocationSize(value.publish) + - FfiConverterOptionalMoqOriginProducer.allocationSize(value.consume) + + static int allocationSize(MoqVideoProperties value) { + return FfiConverterOptionalMoqDimensions.allocationSize(value.display) + + FfiConverterOptionalDouble64.allocationSize(value.rotation) + + FfiConverterOptionalBool.allocationSize(value.flip) + 0; } } -class MoqServerTls { - final List cert; - final List key; - final List generate; - MoqServerTls({ - this.cert = const [], - this.key = const [], - this.generate = const [], - }); +class MoqAnnounce { + final String prefix; + final List? captures; + final MoqRoute route; + MoqAnnounce({required this.prefix, this.captures, required this.route}); } -class FfiConverterMoqServerTls { - static MoqServerTls lift(RustBuffer buf) { - return FfiConverterMoqServerTls.read(buf.asUint8List()).value; +class FfiConverterMoqAnnounce { + static MoqAnnounce lift(RustBuffer buf) { + return FfiConverterMoqAnnounce.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final cert_lifted = FfiConverterSequenceString.read( + final prefix_lifted = FfiConverterString.read( Uint8List.view(buf.buffer, new_offset), ); - final cert = cert_lifted.value; - new_offset += cert_lifted.bytesRead; - final key_lifted = FfiConverterSequenceString.read( + final prefix = prefix_lifted.value; + new_offset += prefix_lifted.bytesRead; + final captures_lifted = FfiConverterOptionalSequenceString.read( Uint8List.view(buf.buffer, new_offset), ); - final key = key_lifted.value; - new_offset += key_lifted.bytesRead; - final generate_lifted = FfiConverterSequenceString.read( + final captures = captures_lifted.value; + new_offset += captures_lifted.bytesRead; + final route_lifted = FfiConverterMoqRoute.read( Uint8List.view(buf.buffer, new_offset), ); - final generate = generate_lifted.value; - new_offset += generate_lifted.bytesRead; + final route = route_lifted.value; + new_offset += route_lifted.bytesRead; return LiftRetVal( - MoqServerTls(cert: cert, key: key, generate: generate), + MoqAnnounce(prefix: prefix, captures: captures, route: route), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(MoqServerTls value) { + static RustBuffer lower(MoqAnnounce value) { final total_length = - FfiConverterSequenceString.allocationSize(value.cert) + - FfiConverterSequenceString.allocationSize(value.key) + - FfiConverterSequenceString.allocationSize(value.generate) + + FfiConverterString.allocationSize(value.prefix) + + FfiConverterOptionalSequenceString.allocationSize(value.captures) + + FfiConverterMoqRoute.allocationSize(value.route) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(MoqServerTls value, Uint8List buf) { + static int write(MoqAnnounce value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += FfiConverterSequenceString.write( - value.cert, + new_offset += FfiConverterString.write( + value.prefix, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterSequenceString.write( - value.key, + new_offset += FfiConverterOptionalSequenceString.write( + value.captures, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterSequenceString.write( - value.generate, + new_offset += FfiConverterMoqRoute.write( + value.route, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(MoqServerTls value) { - return FfiConverterSequenceString.allocationSize(value.cert) + - FfiConverterSequenceString.allocationSize(value.key) + - FfiConverterSequenceString.allocationSize(value.generate) + + static int allocationSize(MoqAnnounce value) { + return FfiConverterString.allocationSize(value.prefix) + + FfiConverterOptionalSequenceString.allocationSize(value.captures) + + FfiConverterMoqRoute.allocationSize(value.route) + 0; } } -class MoqBackoff { - final int? initialUs; - final int? multiplier; - final int? maxUs; - final int? timeoutUs; - MoqBackoff({ - this.initialUs = null, - this.multiplier = null, - this.maxUs = null, - this.timeoutUs = null, +class MoqAnnounceConfig { + final String prefix; + final String? filter; + final bool hidden; + MoqAnnounceConfig({ + this.prefix = '', + this.filter = null, + this.hidden = false, }); } -class FfiConverterMoqBackoff { - static MoqBackoff lift(RustBuffer buf) { - return FfiConverterMoqBackoff.read(buf.asUint8List()).value; +class FfiConverterMoqAnnounceConfig { + static MoqAnnounceConfig lift(RustBuffer buf) { + return FfiConverterMoqAnnounceConfig.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final initialUs_lifted = FfiConverterOptionalUInt64.read( - Uint8List.view(buf.buffer, new_offset), - ); - final initialUs = initialUs_lifted.value; - new_offset += initialUs_lifted.bytesRead; - final multiplier_lifted = FfiConverterOptionalUInt32.read( + final prefix_lifted = FfiConverterString.read( Uint8List.view(buf.buffer, new_offset), ); - final multiplier = multiplier_lifted.value; - new_offset += multiplier_lifted.bytesRead; - final maxUs_lifted = FfiConverterOptionalUInt64.read( + final prefix = prefix_lifted.value; + new_offset += prefix_lifted.bytesRead; + final filter_lifted = FfiConverterOptionalString.read( Uint8List.view(buf.buffer, new_offset), ); - final maxUs = maxUs_lifted.value; - new_offset += maxUs_lifted.bytesRead; - final timeoutUs_lifted = FfiConverterOptionalUInt64.read( + final filter = filter_lifted.value; + new_offset += filter_lifted.bytesRead; + final hidden_lifted = FfiConverterBool.read( Uint8List.view(buf.buffer, new_offset), ); - final timeoutUs = timeoutUs_lifted.value; - new_offset += timeoutUs_lifted.bytesRead; + final hidden = hidden_lifted.value; + new_offset += hidden_lifted.bytesRead; return LiftRetVal( - MoqBackoff( - initialUs: initialUs, - multiplier: multiplier, - maxUs: maxUs, - timeoutUs: timeoutUs, - ), + MoqAnnounceConfig(prefix: prefix, filter: filter, hidden: hidden), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(MoqBackoff value) { + static RustBuffer lower(MoqAnnounceConfig value) { final total_length = - FfiConverterOptionalUInt64.allocationSize(value.initialUs) + - FfiConverterOptionalUInt32.allocationSize(value.multiplier) + - FfiConverterOptionalUInt64.allocationSize(value.maxUs) + - FfiConverterOptionalUInt64.allocationSize(value.timeoutUs) + + FfiConverterString.allocationSize(value.prefix) + + FfiConverterOptionalString.allocationSize(value.filter) + + FfiConverterBool.allocationSize(value.hidden) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(MoqBackoff value, Uint8List buf) { + static int write(MoqAnnounceConfig value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += FfiConverterOptionalUInt64.write( - value.initialUs, + new_offset += FfiConverterString.write( + value.prefix, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterOptionalUInt32.write( - value.multiplier, + new_offset += FfiConverterOptionalString.write( + value.filter, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterOptionalUInt64.write( - value.maxUs, + new_offset += FfiConverterBool.write( + value.hidden, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset - buf.offsetInBytes; + } + + static int allocationSize(MoqAnnounceConfig value) { + return FfiConverterString.allocationSize(value.prefix) + + FfiConverterOptionalString.allocationSize(value.filter) + + FfiConverterBool.allocationSize(value.hidden) + + 0; + } +} + +class MoqOriginConfig { + final int? cacheCapacityBytes; + MoqOriginConfig({this.cacheCapacityBytes = null}); +} + +class FfiConverterMoqOriginConfig { + static MoqOriginConfig lift(RustBuffer buf) { + return FfiConverterMoqOriginConfig.read(buf.asUint8List()).value; + } + + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final cacheCapacityBytes_lifted = FfiConverterOptionalUInt64.read( Uint8List.view(buf.buffer, new_offset), ); + final cacheCapacityBytes = cacheCapacityBytes_lifted.value; + new_offset += cacheCapacityBytes_lifted.bytesRead; + return LiftRetVal( + MoqOriginConfig(cacheCapacityBytes: cacheCapacityBytes), + new_offset - buf.offsetInBytes, + ); + } + + static RustBuffer lower(MoqOriginConfig value) { + final total_length = + FfiConverterOptionalUInt64.allocationSize(value.cacheCapacityBytes) + 0; + final buf = Uint8List(total_length); + write(value, buf); + return toRustBuffer(buf); + } + + static int write(MoqOriginConfig value, Uint8List buf) { + int new_offset = buf.offsetInBytes; new_offset += FfiConverterOptionalUInt64.write( - value.timeoutUs, + value.cacheCapacityBytes, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(MoqBackoff value) { - return FfiConverterOptionalUInt64.allocationSize(value.initialUs) + - FfiConverterOptionalUInt32.allocationSize(value.multiplier) + - FfiConverterOptionalUInt64.allocationSize(value.maxUs) + - FfiConverterOptionalUInt64.allocationSize(value.timeoutUs) + + static int allocationSize(MoqOriginConfig value) { + return FfiConverterOptionalUInt64.allocationSize(value.cacheCapacityBytes) + 0; } } -class MoqClientConfig { - final String? bind; - final List versions; - final MoqClientTls tls; - final MoqQuicConfig quic; - final MoqWebSocketConfig websocket; - final bool once; - final MoqBackoff backoff; - final MoqOriginProducer? publish; - final MoqOriginProducer? consume; - MoqClientConfig({ - this.bind = null, - this.versions = const [], - required this.tls, - required this.quic, - required this.websocket, - this.once = false, - required this.backoff, - this.publish = null, - this.consume = null, +class MoqRoute { + final List hops; + final int cost; + final bool anonymous; + final String? epoch; + MoqRoute({ + this.hops = const [], + this.cost = 0, + this.anonymous = false, + this.epoch = null, }); } -class FfiConverterMoqClientConfig { - static MoqClientConfig lift(RustBuffer buf) { - return FfiConverterMoqClientConfig.read(buf.asUint8List()).value; +class FfiConverterMoqRoute { + static MoqRoute lift(RustBuffer buf) { + return FfiConverterMoqRoute.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final bind_lifted = FfiConverterOptionalString.read( + final hops_lifted = FfiConverterSequenceUInt64.read( Uint8List.view(buf.buffer, new_offset), ); - final bind = bind_lifted.value; - new_offset += bind_lifted.bytesRead; - final versions_lifted = FfiConverterSequenceString.read( + final hops = hops_lifted.value; + new_offset += hops_lifted.bytesRead; + final cost_lifted = FfiConverterUInt64.read( Uint8List.view(buf.buffer, new_offset), ); - final versions = versions_lifted.value; - new_offset += versions_lifted.bytesRead; - final tls_lifted = FfiConverterMoqClientTls.read( + final cost = cost_lifted.value; + new_offset += cost_lifted.bytesRead; + final anonymous_lifted = FfiConverterBool.read( Uint8List.view(buf.buffer, new_offset), ); - final tls = tls_lifted.value; - new_offset += tls_lifted.bytesRead; - final quic_lifted = FfiConverterMoqQuicConfig.read( + final anonymous = anonymous_lifted.value; + new_offset += anonymous_lifted.bytesRead; + final epoch_lifted = FfiConverterOptionalString.read( Uint8List.view(buf.buffer, new_offset), ); - final quic = quic_lifted.value; - new_offset += quic_lifted.bytesRead; - final websocket_lifted = FfiConverterMoqWebSocketConfig.read( + final epoch = epoch_lifted.value; + new_offset += epoch_lifted.bytesRead; + return LiftRetVal( + MoqRoute(hops: hops, cost: cost, anonymous: anonymous, epoch: epoch), + new_offset - buf.offsetInBytes, + ); + } + + static RustBuffer lower(MoqRoute value) { + final total_length = + FfiConverterSequenceUInt64.allocationSize(value.hops) + + FfiConverterUInt64.allocationSize(value.cost) + + FfiConverterBool.allocationSize(value.anonymous) + + FfiConverterOptionalString.allocationSize(value.epoch) + + 0; + final buf = Uint8List(total_length); + write(value, buf); + return toRustBuffer(buf); + } + + static int write(MoqRoute value, Uint8List buf) { + int new_offset = buf.offsetInBytes; + new_offset += FfiConverterSequenceUInt64.write( + value.hops, Uint8List.view(buf.buffer, new_offset), ); - final websocket = websocket_lifted.value; - new_offset += websocket_lifted.bytesRead; - final once_lifted = FfiConverterBool.read( + new_offset += FfiConverterUInt64.write( + value.cost, Uint8List.view(buf.buffer, new_offset), ); - final once = once_lifted.value; - new_offset += once_lifted.bytesRead; - final backoff_lifted = FfiConverterMoqBackoff.read( + new_offset += FfiConverterBool.write( + value.anonymous, Uint8List.view(buf.buffer, new_offset), ); - final backoff = backoff_lifted.value; - new_offset += backoff_lifted.bytesRead; - final publish_lifted = FfiConverterOptionalMoqOriginProducer.read( + new_offset += FfiConverterOptionalString.write( + value.epoch, Uint8List.view(buf.buffer, new_offset), ); - final publish = publish_lifted.value; - new_offset += publish_lifted.bytesRead; + return new_offset - buf.offsetInBytes; + } + + static int allocationSize(MoqRoute value) { + return FfiConverterSequenceUInt64.allocationSize(value.hops) + + FfiConverterUInt64.allocationSize(value.cost) + + FfiConverterBool.allocationSize(value.anonymous) + + FfiConverterOptionalString.allocationSize(value.epoch) + + 0; + } +} + +class MoqTrackInfo { + final int priority; + final int? maxAgeUs; + final int? timescale; + MoqTrackInfo({ + this.priority = 127, + this.maxAgeUs = null, + this.timescale = null, + }); +} + +class FfiConverterMoqTrackInfo { + static MoqTrackInfo lift(RustBuffer buf) { + return FfiConverterMoqTrackInfo.read(buf.asUint8List()).value; + } + + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final priority_lifted = FfiConverterUInt8.read( + Uint8List.view(buf.buffer, new_offset), + ); + final priority = priority_lifted.value; + new_offset += priority_lifted.bytesRead; + final maxAgeUs_lifted = FfiConverterOptionalUInt64.read( + Uint8List.view(buf.buffer, new_offset), + ); + final maxAgeUs = maxAgeUs_lifted.value; + new_offset += maxAgeUs_lifted.bytesRead; + final timescale_lifted = FfiConverterOptionalUInt64.read( + Uint8List.view(buf.buffer, new_offset), + ); + final timescale = timescale_lifted.value; + new_offset += timescale_lifted.bytesRead; + return LiftRetVal( + MoqTrackInfo( + priority: priority, + maxAgeUs: maxAgeUs, + timescale: timescale, + ), + new_offset - buf.offsetInBytes, + ); + } + + static RustBuffer lower(MoqTrackInfo value) { + final total_length = + FfiConverterUInt8.allocationSize(value.priority) + + FfiConverterOptionalUInt64.allocationSize(value.maxAgeUs) + + FfiConverterOptionalUInt64.allocationSize(value.timescale) + + 0; + final buf = Uint8List(total_length); + write(value, buf); + return toRustBuffer(buf); + } + + static int write(MoqTrackInfo value, Uint8List buf) { + int new_offset = buf.offsetInBytes; + new_offset += FfiConverterUInt8.write( + value.priority, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalUInt64.write( + value.maxAgeUs, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalUInt64.write( + value.timescale, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset - buf.offsetInBytes; + } + + static int allocationSize(MoqTrackInfo value) { + return FfiConverterUInt8.allocationSize(value.priority) + + FfiConverterOptionalUInt64.allocationSize(value.maxAgeUs) + + FfiConverterOptionalUInt64.allocationSize(value.timescale) + + 0; + } +} + +class MoqServerConfig { + final String? bind; + final List versions; + final MoqServerTls tls; + final MoqQuicConfig quic; + final MoqOriginProducer? publish; + final MoqOriginProducer? consume; + MoqServerConfig({ + this.bind = null, + this.versions = const [], + required this.tls, + required this.quic, + this.publish = null, + this.consume = null, + }); +} + +class FfiConverterMoqServerConfig { + static MoqServerConfig lift(RustBuffer buf) { + return FfiConverterMoqServerConfig.read(buf.asUint8List()).value; + } + + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final bind_lifted = FfiConverterOptionalString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final bind = bind_lifted.value; + new_offset += bind_lifted.bytesRead; + final versions_lifted = FfiConverterSequenceString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final versions = versions_lifted.value; + new_offset += versions_lifted.bytesRead; + final tls_lifted = FfiConverterMoqServerTls.read( + Uint8List.view(buf.buffer, new_offset), + ); + final tls = tls_lifted.value; + new_offset += tls_lifted.bytesRead; + final quic_lifted = FfiConverterMoqQuicConfig.read( + Uint8List.view(buf.buffer, new_offset), + ); + final quic = quic_lifted.value; + new_offset += quic_lifted.bytesRead; + final publish_lifted = FfiConverterOptionalMoqOriginProducer.read( + Uint8List.view(buf.buffer, new_offset), + ); + final publish = publish_lifted.value; + new_offset += publish_lifted.bytesRead; final consume_lifted = FfiConverterOptionalMoqOriginProducer.read( Uint8List.view(buf.buffer, new_offset), ); final consume = consume_lifted.value; new_offset += consume_lifted.bytesRead; return LiftRetVal( - MoqClientConfig( + MoqServerConfig( bind: bind, versions: versions, tls: tls, quic: quic, - websocket: websocket, - once: once, - backoff: backoff, publish: publish, consume: consume, ), @@ -2552,15 +2706,12 @@ class FfiConverterMoqClientConfig { ); } - static RustBuffer lower(MoqClientConfig value) { + static RustBuffer lower(MoqServerConfig value) { final total_length = FfiConverterOptionalString.allocationSize(value.bind) + FfiConverterSequenceString.allocationSize(value.versions) + - FfiConverterMoqClientTls.allocationSize(value.tls) + + FfiConverterMoqServerTls.allocationSize(value.tls) + FfiConverterMoqQuicConfig.allocationSize(value.quic) + - FfiConverterMoqWebSocketConfig.allocationSize(value.websocket) + - FfiConverterBool.allocationSize(value.once) + - FfiConverterMoqBackoff.allocationSize(value.backoff) + FfiConverterOptionalMoqOriginProducer.allocationSize(value.publish) + FfiConverterOptionalMoqOriginProducer.allocationSize(value.consume) + 0; @@ -2569,7 +2720,7 @@ class FfiConverterMoqClientConfig { return toRustBuffer(buf); } - static int write(MoqClientConfig value, Uint8List buf) { + static int write(MoqServerConfig value, Uint8List buf) { int new_offset = buf.offsetInBytes; new_offset += FfiConverterOptionalString.write( value.bind, @@ -2579,7 +2730,7 @@ class FfiConverterMoqClientConfig { value.versions, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterMoqClientTls.write( + new_offset += FfiConverterMoqServerTls.write( value.tls, Uint8List.view(buf.buffer, new_offset), ); @@ -2587,18 +2738,6 @@ class FfiConverterMoqClientConfig { value.quic, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterMoqWebSocketConfig.write( - value.websocket, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterBool.write( - value.once, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterMoqBackoff.write( - value.backoff, - Uint8List.view(buf.buffer, new_offset), - ); new_offset += FfiConverterOptionalMoqOriginProducer.write( value.publish, Uint8List.view(buf.buffer, new_offset), @@ -2610,619 +2749,2757 @@ class FfiConverterMoqClientConfig { return new_offset - buf.offsetInBytes; } - static int allocationSize(MoqClientConfig value) { + static int allocationSize(MoqServerConfig value) { return FfiConverterOptionalString.allocationSize(value.bind) + FfiConverterSequenceString.allocationSize(value.versions) + - FfiConverterMoqClientTls.allocationSize(value.tls) + + FfiConverterMoqServerTls.allocationSize(value.tls) + FfiConverterMoqQuicConfig.allocationSize(value.quic) + - FfiConverterMoqWebSocketConfig.allocationSize(value.websocket) + - FfiConverterBool.allocationSize(value.once) + - FfiConverterMoqBackoff.allocationSize(value.backoff) + FfiConverterOptionalMoqOriginProducer.allocationSize(value.publish) + FfiConverterOptionalMoqOriginProducer.allocationSize(value.consume) + 0; } } -class MoqClientTls { - final bool insecure; - final List roots; - final bool? systemRoots; - final List fingerprints; - final String? cert; - final String? key; - MoqClientTls({ - this.insecure = false, - this.roots = const [], - this.systemRoots = null, - this.fingerprints = const [], - this.cert = null, - this.key = null, +class MoqServerTls { + final List cert; + final List key; + final List generate; + MoqServerTls({ + this.cert = const [], + this.key = const [], + this.generate = const [], }); } -class FfiConverterMoqClientTls { - static MoqClientTls lift(RustBuffer buf) { - return FfiConverterMoqClientTls.read(buf.asUint8List()).value; +class FfiConverterMoqServerTls { + static MoqServerTls lift(RustBuffer buf) { + return FfiConverterMoqServerTls.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final insecure_lifted = FfiConverterBool.read( - Uint8List.view(buf.buffer, new_offset), - ); - final insecure = insecure_lifted.value; - new_offset += insecure_lifted.bytesRead; - final roots_lifted = FfiConverterSequenceString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final roots = roots_lifted.value; - new_offset += roots_lifted.bytesRead; - final systemRoots_lifted = FfiConverterOptionalBool.read( - Uint8List.view(buf.buffer, new_offset), - ); - final systemRoots = systemRoots_lifted.value; - new_offset += systemRoots_lifted.bytesRead; - final fingerprints_lifted = FfiConverterSequenceString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final fingerprints = fingerprints_lifted.value; - new_offset += fingerprints_lifted.bytesRead; - final cert_lifted = FfiConverterOptionalString.read( + final cert_lifted = FfiConverterSequenceString.read( Uint8List.view(buf.buffer, new_offset), ); final cert = cert_lifted.value; new_offset += cert_lifted.bytesRead; - final key_lifted = FfiConverterOptionalString.read( + final key_lifted = FfiConverterSequenceString.read( Uint8List.view(buf.buffer, new_offset), ); final key = key_lifted.value; new_offset += key_lifted.bytesRead; + final generate_lifted = FfiConverterSequenceString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final generate = generate_lifted.value; + new_offset += generate_lifted.bytesRead; return LiftRetVal( - MoqClientTls( - insecure: insecure, - roots: roots, - systemRoots: systemRoots, - fingerprints: fingerprints, - cert: cert, - key: key, - ), + MoqServerTls(cert: cert, key: key, generate: generate), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(MoqClientTls value) { + static RustBuffer lower(MoqServerTls value) { final total_length = - FfiConverterBool.allocationSize(value.insecure) + - FfiConverterSequenceString.allocationSize(value.roots) + - FfiConverterOptionalBool.allocationSize(value.systemRoots) + - FfiConverterSequenceString.allocationSize(value.fingerprints) + - FfiConverterOptionalString.allocationSize(value.cert) + - FfiConverterOptionalString.allocationSize(value.key) + + FfiConverterSequenceString.allocationSize(value.cert) + + FfiConverterSequenceString.allocationSize(value.key) + + FfiConverterSequenceString.allocationSize(value.generate) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(MoqClientTls value, Uint8List buf) { + static int write(MoqServerTls value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += FfiConverterBool.write( - value.insecure, - Uint8List.view(buf.buffer, new_offset), - ); new_offset += FfiConverterSequenceString.write( - value.roots, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalBool.write( - value.systemRoots, + value.cert, Uint8List.view(buf.buffer, new_offset), ); new_offset += FfiConverterSequenceString.write( - value.fingerprints, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalString.write( - value.cert, + value.key, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterOptionalString.write( - value.key, + new_offset += FfiConverterSequenceString.write( + value.generate, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(MoqClientTls value) { - return FfiConverterBool.allocationSize(value.insecure) + - FfiConverterSequenceString.allocationSize(value.roots) + - FfiConverterOptionalBool.allocationSize(value.systemRoots) + - FfiConverterSequenceString.allocationSize(value.fingerprints) + - FfiConverterOptionalString.allocationSize(value.cert) + - FfiConverterOptionalString.allocationSize(value.key) + + static int allocationSize(MoqServerTls value) { + return FfiConverterSequenceString.allocationSize(value.cert) + + FfiConverterSequenceString.allocationSize(value.key) + + FfiConverterSequenceString.allocationSize(value.generate) + 0; } } -class MoqConnectionStats { - final int? rttUs; - final int? estimatedSendRateBps; - final int? estimatedRecvRateBps; - final int? bytesSent; - final int? bytesReceived; - final int? bytesLost; - final int? packetsSent; - final int? packetsReceived; - final int? packetsLost; - MoqConnectionStats({ - this.rttUs, - this.estimatedSendRateBps, - this.estimatedRecvRateBps, - this.bytesSent, - this.bytesReceived, - this.bytesLost, - this.packetsSent, - this.packetsReceived, - this.packetsLost, +class MoqBackoff { + final int? initialUs; + final int? multiplier; + final int? maxUs; + final int? timeoutUs; + MoqBackoff({ + this.initialUs = null, + this.multiplier = null, + this.maxUs = null, + this.timeoutUs = null, }); } -class FfiConverterMoqConnectionStats { - static MoqConnectionStats lift(RustBuffer buf) { - return FfiConverterMoqConnectionStats.read(buf.asUint8List()).value; +class FfiConverterMoqBackoff { + static MoqBackoff lift(RustBuffer buf) { + return FfiConverterMoqBackoff.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final rttUs_lifted = FfiConverterOptionalUInt64.read( - Uint8List.view(buf.buffer, new_offset), - ); - final rttUs = rttUs_lifted.value; - new_offset += rttUs_lifted.bytesRead; - final estimatedSendRateBps_lifted = FfiConverterOptionalUInt64.read( - Uint8List.view(buf.buffer, new_offset), - ); - final estimatedSendRateBps = estimatedSendRateBps_lifted.value; - new_offset += estimatedSendRateBps_lifted.bytesRead; - final estimatedRecvRateBps_lifted = FfiConverterOptionalUInt64.read( - Uint8List.view(buf.buffer, new_offset), - ); - final estimatedRecvRateBps = estimatedRecvRateBps_lifted.value; - new_offset += estimatedRecvRateBps_lifted.bytesRead; - final bytesSent_lifted = FfiConverterOptionalUInt64.read( - Uint8List.view(buf.buffer, new_offset), - ); - final bytesSent = bytesSent_lifted.value; - new_offset += bytesSent_lifted.bytesRead; - final bytesReceived_lifted = FfiConverterOptionalUInt64.read( - Uint8List.view(buf.buffer, new_offset), - ); - final bytesReceived = bytesReceived_lifted.value; - new_offset += bytesReceived_lifted.bytesRead; - final bytesLost_lifted = FfiConverterOptionalUInt64.read( + final initialUs_lifted = FfiConverterOptionalUInt64.read( Uint8List.view(buf.buffer, new_offset), ); - final bytesLost = bytesLost_lifted.value; - new_offset += bytesLost_lifted.bytesRead; - final packetsSent_lifted = FfiConverterOptionalUInt64.read( + final initialUs = initialUs_lifted.value; + new_offset += initialUs_lifted.bytesRead; + final multiplier_lifted = FfiConverterOptionalUInt32.read( Uint8List.view(buf.buffer, new_offset), ); - final packetsSent = packetsSent_lifted.value; - new_offset += packetsSent_lifted.bytesRead; - final packetsReceived_lifted = FfiConverterOptionalUInt64.read( + final multiplier = multiplier_lifted.value; + new_offset += multiplier_lifted.bytesRead; + final maxUs_lifted = FfiConverterOptionalUInt64.read( Uint8List.view(buf.buffer, new_offset), ); - final packetsReceived = packetsReceived_lifted.value; - new_offset += packetsReceived_lifted.bytesRead; - final packetsLost_lifted = FfiConverterOptionalUInt64.read( + final maxUs = maxUs_lifted.value; + new_offset += maxUs_lifted.bytesRead; + final timeoutUs_lifted = FfiConverterOptionalUInt64.read( Uint8List.view(buf.buffer, new_offset), ); - final packetsLost = packetsLost_lifted.value; - new_offset += packetsLost_lifted.bytesRead; + final timeoutUs = timeoutUs_lifted.value; + new_offset += timeoutUs_lifted.bytesRead; return LiftRetVal( - MoqConnectionStats( - rttUs: rttUs, - estimatedSendRateBps: estimatedSendRateBps, - estimatedRecvRateBps: estimatedRecvRateBps, - bytesSent: bytesSent, - bytesReceived: bytesReceived, - bytesLost: bytesLost, - packetsSent: packetsSent, - packetsReceived: packetsReceived, - packetsLost: packetsLost, + MoqBackoff( + initialUs: initialUs, + multiplier: multiplier, + maxUs: maxUs, + timeoutUs: timeoutUs, ), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(MoqConnectionStats value) { + static RustBuffer lower(MoqBackoff value) { final total_length = - FfiConverterOptionalUInt64.allocationSize(value.rttUs) + - FfiConverterOptionalUInt64.allocationSize(value.estimatedSendRateBps) + - FfiConverterOptionalUInt64.allocationSize(value.estimatedRecvRateBps) + - FfiConverterOptionalUInt64.allocationSize(value.bytesSent) + - FfiConverterOptionalUInt64.allocationSize(value.bytesReceived) + - FfiConverterOptionalUInt64.allocationSize(value.bytesLost) + - FfiConverterOptionalUInt64.allocationSize(value.packetsSent) + - FfiConverterOptionalUInt64.allocationSize(value.packetsReceived) + - FfiConverterOptionalUInt64.allocationSize(value.packetsLost) + + FfiConverterOptionalUInt64.allocationSize(value.initialUs) + + FfiConverterOptionalUInt32.allocationSize(value.multiplier) + + FfiConverterOptionalUInt64.allocationSize(value.maxUs) + + FfiConverterOptionalUInt64.allocationSize(value.timeoutUs) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(MoqConnectionStats value, Uint8List buf) { + static int write(MoqBackoff value, Uint8List buf) { int new_offset = buf.offsetInBytes; new_offset += FfiConverterOptionalUInt64.write( - value.rttUs, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalUInt64.write( - value.estimatedSendRateBps, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalUInt64.write( - value.estimatedRecvRateBps, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalUInt64.write( - value.bytesSent, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalUInt64.write( - value.bytesReceived, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalUInt64.write( - value.bytesLost, + value.initialUs, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterOptionalUInt64.write( - value.packetsSent, + new_offset += FfiConverterOptionalUInt32.write( + value.multiplier, Uint8List.view(buf.buffer, new_offset), ); new_offset += FfiConverterOptionalUInt64.write( - value.packetsReceived, + value.maxUs, Uint8List.view(buf.buffer, new_offset), ); new_offset += FfiConverterOptionalUInt64.write( - value.packetsLost, + value.timeoutUs, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(MoqConnectionStats value) { - return FfiConverterOptionalUInt64.allocationSize(value.rttUs) + - FfiConverterOptionalUInt64.allocationSize(value.estimatedSendRateBps) + - FfiConverterOptionalUInt64.allocationSize(value.estimatedRecvRateBps) + - FfiConverterOptionalUInt64.allocationSize(value.bytesSent) + - FfiConverterOptionalUInt64.allocationSize(value.bytesReceived) + - FfiConverterOptionalUInt64.allocationSize(value.bytesLost) + - FfiConverterOptionalUInt64.allocationSize(value.packetsSent) + - FfiConverterOptionalUInt64.allocationSize(value.packetsReceived) + - FfiConverterOptionalUInt64.allocationSize(value.packetsLost) + + static int allocationSize(MoqBackoff value) { + return FfiConverterOptionalUInt64.allocationSize(value.initialUs) + + FfiConverterOptionalUInt32.allocationSize(value.multiplier) + + FfiConverterOptionalUInt64.allocationSize(value.maxUs) + + FfiConverterOptionalUInt64.allocationSize(value.timeoutUs) + 0; } } -class MoqQuicConfig { - final int? maxStreams; - MoqQuicConfig({this.maxStreams = null}); +class MoqClientConfig { + final String? bind; + final List versions; + final MoqClientTls tls; + final MoqQuicConfig quic; + final MoqWebSocketConfig websocket; + final bool once; + final MoqBackoff backoff; + final MoqOriginProducer? publish; + final MoqOriginProducer? consume; + MoqClientConfig({ + this.bind = null, + this.versions = const [], + required this.tls, + required this.quic, + required this.websocket, + this.once = false, + required this.backoff, + this.publish = null, + this.consume = null, + }); } -class FfiConverterMoqQuicConfig { - static MoqQuicConfig lift(RustBuffer buf) { - return FfiConverterMoqQuicConfig.read(buf.asUint8List()).value; +class FfiConverterMoqClientConfig { + static MoqClientConfig lift(RustBuffer buf) { + return FfiConverterMoqClientConfig.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final maxStreams_lifted = FfiConverterOptionalUInt64.read( + final bind_lifted = FfiConverterOptionalString.read( Uint8List.view(buf.buffer, new_offset), ); - final maxStreams = maxStreams_lifted.value; - new_offset += maxStreams_lifted.bytesRead; - return LiftRetVal( - MoqQuicConfig(maxStreams: maxStreams), - new_offset - buf.offsetInBytes, + final bind = bind_lifted.value; + new_offset += bind_lifted.bytesRead; + final versions_lifted = FfiConverterSequenceString.read( + Uint8List.view(buf.buffer, new_offset), ); - } - - static RustBuffer lower(MoqQuicConfig value) { - final total_length = - FfiConverterOptionalUInt64.allocationSize(value.maxStreams) + 0; - final buf = Uint8List(total_length); - write(value, buf); - return toRustBuffer(buf); - } - - static int write(MoqQuicConfig value, Uint8List buf) { - int new_offset = buf.offsetInBytes; - new_offset += FfiConverterOptionalUInt64.write( - value.maxStreams, + final versions = versions_lifted.value; + new_offset += versions_lifted.bytesRead; + final tls_lifted = FfiConverterMoqClientTls.read( Uint8List.view(buf.buffer, new_offset), ); - return new_offset - buf.offsetInBytes; + final tls = tls_lifted.value; + new_offset += tls_lifted.bytesRead; + final quic_lifted = FfiConverterMoqQuicConfig.read( + Uint8List.view(buf.buffer, new_offset), + ); + final quic = quic_lifted.value; + new_offset += quic_lifted.bytesRead; + final websocket_lifted = FfiConverterMoqWebSocketConfig.read( + Uint8List.view(buf.buffer, new_offset), + ); + final websocket = websocket_lifted.value; + new_offset += websocket_lifted.bytesRead; + final once_lifted = FfiConverterBool.read( + Uint8List.view(buf.buffer, new_offset), + ); + final once = once_lifted.value; + new_offset += once_lifted.bytesRead; + final backoff_lifted = FfiConverterMoqBackoff.read( + Uint8List.view(buf.buffer, new_offset), + ); + final backoff = backoff_lifted.value; + new_offset += backoff_lifted.bytesRead; + final publish_lifted = FfiConverterOptionalMoqOriginProducer.read( + Uint8List.view(buf.buffer, new_offset), + ); + final publish = publish_lifted.value; + new_offset += publish_lifted.bytesRead; + final consume_lifted = FfiConverterOptionalMoqOriginProducer.read( + Uint8List.view(buf.buffer, new_offset), + ); + final consume = consume_lifted.value; + new_offset += consume_lifted.bytesRead; + return LiftRetVal( + MoqClientConfig( + bind: bind, + versions: versions, + tls: tls, + quic: quic, + websocket: websocket, + once: once, + backoff: backoff, + publish: publish, + consume: consume, + ), + new_offset - buf.offsetInBytes, + ); } - static int allocationSize(MoqQuicConfig value) { - return FfiConverterOptionalUInt64.allocationSize(value.maxStreams) + 0; + static RustBuffer lower(MoqClientConfig value) { + final total_length = + FfiConverterOptionalString.allocationSize(value.bind) + + FfiConverterSequenceString.allocationSize(value.versions) + + FfiConverterMoqClientTls.allocationSize(value.tls) + + FfiConverterMoqQuicConfig.allocationSize(value.quic) + + FfiConverterMoqWebSocketConfig.allocationSize(value.websocket) + + FfiConverterBool.allocationSize(value.once) + + FfiConverterMoqBackoff.allocationSize(value.backoff) + + FfiConverterOptionalMoqOriginProducer.allocationSize(value.publish) + + FfiConverterOptionalMoqOriginProducer.allocationSize(value.consume) + + 0; + final buf = Uint8List(total_length); + write(value, buf); + return toRustBuffer(buf); + } + + static int write(MoqClientConfig value, Uint8List buf) { + int new_offset = buf.offsetInBytes; + new_offset += FfiConverterOptionalString.write( + value.bind, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterSequenceString.write( + value.versions, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterMoqClientTls.write( + value.tls, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterMoqQuicConfig.write( + value.quic, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterMoqWebSocketConfig.write( + value.websocket, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterBool.write( + value.once, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterMoqBackoff.write( + value.backoff, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalMoqOriginProducer.write( + value.publish, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalMoqOriginProducer.write( + value.consume, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset - buf.offsetInBytes; + } + + static int allocationSize(MoqClientConfig value) { + return FfiConverterOptionalString.allocationSize(value.bind) + + FfiConverterSequenceString.allocationSize(value.versions) + + FfiConverterMoqClientTls.allocationSize(value.tls) + + FfiConverterMoqQuicConfig.allocationSize(value.quic) + + FfiConverterMoqWebSocketConfig.allocationSize(value.websocket) + + FfiConverterBool.allocationSize(value.once) + + FfiConverterMoqBackoff.allocationSize(value.backoff) + + FfiConverterOptionalMoqOriginProducer.allocationSize(value.publish) + + FfiConverterOptionalMoqOriginProducer.allocationSize(value.consume) + + 0; } } -class MoqWebSocketConfig { - final bool? enabled; - final int? delayUs; - MoqWebSocketConfig({this.enabled = null, this.delayUs = null}); +class MoqClientTls { + final bool insecure; + final List roots; + final bool? systemRoots; + final List fingerprints; + final String? cert; + final String? key; + MoqClientTls({ + this.insecure = false, + this.roots = const [], + this.systemRoots = null, + this.fingerprints = const [], + this.cert = null, + this.key = null, + }); } -class FfiConverterMoqWebSocketConfig { - static MoqWebSocketConfig lift(RustBuffer buf) { - return FfiConverterMoqWebSocketConfig.read(buf.asUint8List()).value; +class FfiConverterMoqClientTls { + static MoqClientTls lift(RustBuffer buf) { + return FfiConverterMoqClientTls.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final enabled_lifted = FfiConverterOptionalBool.read( + final insecure_lifted = FfiConverterBool.read( Uint8List.view(buf.buffer, new_offset), ); - final enabled = enabled_lifted.value; - new_offset += enabled_lifted.bytesRead; - final delayUs_lifted = FfiConverterOptionalUInt64.read( + final insecure = insecure_lifted.value; + new_offset += insecure_lifted.bytesRead; + final roots_lifted = FfiConverterSequenceString.read( Uint8List.view(buf.buffer, new_offset), ); - final delayUs = delayUs_lifted.value; - new_offset += delayUs_lifted.bytesRead; + final roots = roots_lifted.value; + new_offset += roots_lifted.bytesRead; + final systemRoots_lifted = FfiConverterOptionalBool.read( + Uint8List.view(buf.buffer, new_offset), + ); + final systemRoots = systemRoots_lifted.value; + new_offset += systemRoots_lifted.bytesRead; + final fingerprints_lifted = FfiConverterSequenceString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final fingerprints = fingerprints_lifted.value; + new_offset += fingerprints_lifted.bytesRead; + final cert_lifted = FfiConverterOptionalString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final cert = cert_lifted.value; + new_offset += cert_lifted.bytesRead; + final key_lifted = FfiConverterOptionalString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final key = key_lifted.value; + new_offset += key_lifted.bytesRead; return LiftRetVal( - MoqWebSocketConfig(enabled: enabled, delayUs: delayUs), + MoqClientTls( + insecure: insecure, + roots: roots, + systemRoots: systemRoots, + fingerprints: fingerprints, + cert: cert, + key: key, + ), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(MoqWebSocketConfig value) { + static RustBuffer lower(MoqClientTls value) { final total_length = - FfiConverterOptionalBool.allocationSize(value.enabled) + - FfiConverterOptionalUInt64.allocationSize(value.delayUs) + + FfiConverterBool.allocationSize(value.insecure) + + FfiConverterSequenceString.allocationSize(value.roots) + + FfiConverterOptionalBool.allocationSize(value.systemRoots) + + FfiConverterSequenceString.allocationSize(value.fingerprints) + + FfiConverterOptionalString.allocationSize(value.cert) + + FfiConverterOptionalString.allocationSize(value.key) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(MoqWebSocketConfig value, Uint8List buf) { + static int write(MoqClientTls value, Uint8List buf) { int new_offset = buf.offsetInBytes; + new_offset += FfiConverterBool.write( + value.insecure, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterSequenceString.write( + value.roots, + Uint8List.view(buf.buffer, new_offset), + ); new_offset += FfiConverterOptionalBool.write( - value.enabled, + value.systemRoots, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterOptionalUInt64.write( - value.delayUs, + new_offset += FfiConverterSequenceString.write( + value.fingerprints, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalString.write( + value.cert, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalString.write( + value.key, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(MoqWebSocketConfig value) { - return FfiConverterOptionalBool.allocationSize(value.enabled) + - FfiConverterOptionalUInt64.allocationSize(value.delayUs) + + static int allocationSize(MoqClientTls value) { + return FfiConverterBool.allocationSize(value.insecure) + + FfiConverterSequenceString.allocationSize(value.roots) + + FfiConverterOptionalBool.allocationSize(value.systemRoots) + + FfiConverterSequenceString.allocationSize(value.fingerprints) + + FfiConverterOptionalString.allocationSize(value.cert) + + FfiConverterOptionalString.allocationSize(value.key) + 0; } } -abstract class MoqException implements Exception { - RustBuffer lower(); - int allocationSize(); - int write(Uint8List buf); - @override - String toString() { - return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqerror_uniffi_trait_display( - FfiConverterMoqException.lower(this), - status, - ), - FfiConverterString.lift, - ); - } -} - -class FfiConverterMoqException { - static MoqException lift(RustBuffer buffer) { - return FfiConverterMoqException.read(buffer.asUint8List()).value; - } - - static LiftRetVal read(Uint8List buf) { - final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); - final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); - switch (index) { - case 1: - final lifted = ProtocolMoqException.read(subview); +class MoqConnectionStats { + final int? rttUs; + final int? estimatedSendRateBps; + final int? estimatedRecvRateBps; + final int? bytesSent; + final int? bytesReceived; + final int? bytesLost; + final int? packetsSent; + final int? packetsReceived; + final int? packetsLost; + MoqConnectionStats({ + this.rttUs, + this.estimatedSendRateBps, + this.estimatedRecvRateBps, + this.bytesSent, + this.bytesReceived, + this.bytesLost, + this.packetsSent, + this.packetsReceived, + this.packetsLost, + }); +} + +class FfiConverterMoqConnectionStats { + static MoqConnectionStats lift(RustBuffer buf) { + return FfiConverterMoqConnectionStats.read(buf.asUint8List()).value; + } + + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final rttUs_lifted = FfiConverterOptionalUInt64.read( + Uint8List.view(buf.buffer, new_offset), + ); + final rttUs = rttUs_lifted.value; + new_offset += rttUs_lifted.bytesRead; + final estimatedSendRateBps_lifted = FfiConverterOptionalUInt64.read( + Uint8List.view(buf.buffer, new_offset), + ); + final estimatedSendRateBps = estimatedSendRateBps_lifted.value; + new_offset += estimatedSendRateBps_lifted.bytesRead; + final estimatedRecvRateBps_lifted = FfiConverterOptionalUInt64.read( + Uint8List.view(buf.buffer, new_offset), + ); + final estimatedRecvRateBps = estimatedRecvRateBps_lifted.value; + new_offset += estimatedRecvRateBps_lifted.bytesRead; + final bytesSent_lifted = FfiConverterOptionalUInt64.read( + Uint8List.view(buf.buffer, new_offset), + ); + final bytesSent = bytesSent_lifted.value; + new_offset += bytesSent_lifted.bytesRead; + final bytesReceived_lifted = FfiConverterOptionalUInt64.read( + Uint8List.view(buf.buffer, new_offset), + ); + final bytesReceived = bytesReceived_lifted.value; + new_offset += bytesReceived_lifted.bytesRead; + final bytesLost_lifted = FfiConverterOptionalUInt64.read( + Uint8List.view(buf.buffer, new_offset), + ); + final bytesLost = bytesLost_lifted.value; + new_offset += bytesLost_lifted.bytesRead; + final packetsSent_lifted = FfiConverterOptionalUInt64.read( + Uint8List.view(buf.buffer, new_offset), + ); + final packetsSent = packetsSent_lifted.value; + new_offset += packetsSent_lifted.bytesRead; + final packetsReceived_lifted = FfiConverterOptionalUInt64.read( + Uint8List.view(buf.buffer, new_offset), + ); + final packetsReceived = packetsReceived_lifted.value; + new_offset += packetsReceived_lifted.bytesRead; + final packetsLost_lifted = FfiConverterOptionalUInt64.read( + Uint8List.view(buf.buffer, new_offset), + ); + final packetsLost = packetsLost_lifted.value; + new_offset += packetsLost_lifted.bytesRead; + return LiftRetVal( + MoqConnectionStats( + rttUs: rttUs, + estimatedSendRateBps: estimatedSendRateBps, + estimatedRecvRateBps: estimatedRecvRateBps, + bytesSent: bytesSent, + bytesReceived: bytesReceived, + bytesLost: bytesLost, + packetsSent: packetsSent, + packetsReceived: packetsReceived, + packetsLost: packetsLost, + ), + new_offset - buf.offsetInBytes, + ); + } + + static RustBuffer lower(MoqConnectionStats value) { + final total_length = + FfiConverterOptionalUInt64.allocationSize(value.rttUs) + + FfiConverterOptionalUInt64.allocationSize(value.estimatedSendRateBps) + + FfiConverterOptionalUInt64.allocationSize(value.estimatedRecvRateBps) + + FfiConverterOptionalUInt64.allocationSize(value.bytesSent) + + FfiConverterOptionalUInt64.allocationSize(value.bytesReceived) + + FfiConverterOptionalUInt64.allocationSize(value.bytesLost) + + FfiConverterOptionalUInt64.allocationSize(value.packetsSent) + + FfiConverterOptionalUInt64.allocationSize(value.packetsReceived) + + FfiConverterOptionalUInt64.allocationSize(value.packetsLost) + + 0; + final buf = Uint8List(total_length); + write(value, buf); + return toRustBuffer(buf); + } + + static int write(MoqConnectionStats value, Uint8List buf) { + int new_offset = buf.offsetInBytes; + new_offset += FfiConverterOptionalUInt64.write( + value.rttUs, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalUInt64.write( + value.estimatedSendRateBps, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalUInt64.write( + value.estimatedRecvRateBps, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalUInt64.write( + value.bytesSent, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalUInt64.write( + value.bytesReceived, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalUInt64.write( + value.bytesLost, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalUInt64.write( + value.packetsSent, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalUInt64.write( + value.packetsReceived, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalUInt64.write( + value.packetsLost, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset - buf.offsetInBytes; + } + + static int allocationSize(MoqConnectionStats value) { + return FfiConverterOptionalUInt64.allocationSize(value.rttUs) + + FfiConverterOptionalUInt64.allocationSize(value.estimatedSendRateBps) + + FfiConverterOptionalUInt64.allocationSize(value.estimatedRecvRateBps) + + FfiConverterOptionalUInt64.allocationSize(value.bytesSent) + + FfiConverterOptionalUInt64.allocationSize(value.bytesReceived) + + FfiConverterOptionalUInt64.allocationSize(value.bytesLost) + + FfiConverterOptionalUInt64.allocationSize(value.packetsSent) + + FfiConverterOptionalUInt64.allocationSize(value.packetsReceived) + + FfiConverterOptionalUInt64.allocationSize(value.packetsLost) + + 0; + } +} + +class MoqQuicConfig { + final int? maxStreams; + MoqQuicConfig({this.maxStreams = null}); +} + +class FfiConverterMoqQuicConfig { + static MoqQuicConfig lift(RustBuffer buf) { + return FfiConverterMoqQuicConfig.read(buf.asUint8List()).value; + } + + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final maxStreams_lifted = FfiConverterOptionalUInt64.read( + Uint8List.view(buf.buffer, new_offset), + ); + final maxStreams = maxStreams_lifted.value; + new_offset += maxStreams_lifted.bytesRead; + return LiftRetVal( + MoqQuicConfig(maxStreams: maxStreams), + new_offset - buf.offsetInBytes, + ); + } + + static RustBuffer lower(MoqQuicConfig value) { + final total_length = + FfiConverterOptionalUInt64.allocationSize(value.maxStreams) + 0; + final buf = Uint8List(total_length); + write(value, buf); + return toRustBuffer(buf); + } + + static int write(MoqQuicConfig value, Uint8List buf) { + int new_offset = buf.offsetInBytes; + new_offset += FfiConverterOptionalUInt64.write( + value.maxStreams, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset - buf.offsetInBytes; + } + + static int allocationSize(MoqQuicConfig value) { + return FfiConverterOptionalUInt64.allocationSize(value.maxStreams) + 0; + } +} + +class MoqWebSocketConfig { + final bool? enabled; + final int? delayUs; + MoqWebSocketConfig({this.enabled = null, this.delayUs = null}); +} + +class FfiConverterMoqWebSocketConfig { + static MoqWebSocketConfig lift(RustBuffer buf) { + return FfiConverterMoqWebSocketConfig.read(buf.asUint8List()).value; + } + + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final enabled_lifted = FfiConverterOptionalBool.read( + Uint8List.view(buf.buffer, new_offset), + ); + final enabled = enabled_lifted.value; + new_offset += enabled_lifted.bytesRead; + final delayUs_lifted = FfiConverterOptionalUInt64.read( + Uint8List.view(buf.buffer, new_offset), + ); + final delayUs = delayUs_lifted.value; + new_offset += delayUs_lifted.bytesRead; + return LiftRetVal( + MoqWebSocketConfig(enabled: enabled, delayUs: delayUs), + new_offset - buf.offsetInBytes, + ); + } + + static RustBuffer lower(MoqWebSocketConfig value) { + final total_length = + FfiConverterOptionalBool.allocationSize(value.enabled) + + FfiConverterOptionalUInt64.allocationSize(value.delayUs) + + 0; + final buf = Uint8List(total_length); + write(value, buf); + return toRustBuffer(buf); + } + + static int write(MoqWebSocketConfig value, Uint8List buf) { + int new_offset = buf.offsetInBytes; + new_offset += FfiConverterOptionalBool.write( + value.enabled, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalUInt64.write( + value.delayUs, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset - buf.offsetInBytes; + } + + static int allocationSize(MoqWebSocketConfig value) { + return FfiConverterOptionalBool.allocationSize(value.enabled) + + FfiConverterOptionalUInt64.allocationSize(value.delayUs) + + 0; + } +} + +class MoqVideoDecoderOutput { + final MoqDimensions? resize; + final int? maxDelayUs; + final bool surface; + MoqVideoDecoderOutput({ + this.resize = null, + this.maxDelayUs = null, + this.surface = false, + }); +} + +class FfiConverterMoqVideoDecoderOutput { + static MoqVideoDecoderOutput lift(RustBuffer buf) { + return FfiConverterMoqVideoDecoderOutput.read(buf.asUint8List()).value; + } + + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final resize_lifted = FfiConverterOptionalMoqDimensions.read( + Uint8List.view(buf.buffer, new_offset), + ); + final resize = resize_lifted.value; + new_offset += resize_lifted.bytesRead; + final maxDelayUs_lifted = FfiConverterOptionalUInt64.read( + Uint8List.view(buf.buffer, new_offset), + ); + final maxDelayUs = maxDelayUs_lifted.value; + new_offset += maxDelayUs_lifted.bytesRead; + final surface_lifted = FfiConverterBool.read( + Uint8List.view(buf.buffer, new_offset), + ); + final surface = surface_lifted.value; + new_offset += surface_lifted.bytesRead; + return LiftRetVal( + MoqVideoDecoderOutput( + resize: resize, + maxDelayUs: maxDelayUs, + surface: surface, + ), + new_offset - buf.offsetInBytes, + ); + } + + static RustBuffer lower(MoqVideoDecoderOutput value) { + final total_length = + FfiConverterOptionalMoqDimensions.allocationSize(value.resize) + + FfiConverterOptionalUInt64.allocationSize(value.maxDelayUs) + + FfiConverterBool.allocationSize(value.surface) + + 0; + final buf = Uint8List(total_length); + write(value, buf); + return toRustBuffer(buf); + } + + static int write(MoqVideoDecoderOutput value, Uint8List buf) { + int new_offset = buf.offsetInBytes; + new_offset += FfiConverterOptionalMoqDimensions.write( + value.resize, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalUInt64.write( + value.maxDelayUs, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterBool.write( + value.surface, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset - buf.offsetInBytes; + } + + static int allocationSize(MoqVideoDecoderOutput value) { + return FfiConverterOptionalMoqDimensions.allocationSize(value.resize) + + FfiConverterOptionalUInt64.allocationSize(value.maxDelayUs) + + FfiConverterBool.allocationSize(value.surface) + + 0; + } +} + +class MoqVideoEncoderInput { + final MoqVideoPixelFormat format; + final int width; + final int height; + final int framerate; + MoqVideoEncoderInput({ + required this.format, + required this.width, + required this.height, + required this.framerate, + }); +} + +class FfiConverterMoqVideoEncoderInput { + static MoqVideoEncoderInput lift(RustBuffer buf) { + return FfiConverterMoqVideoEncoderInput.read(buf.asUint8List()).value; + } + + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final format_lifted = FfiConverterMoqVideoPixelFormat.read( + Uint8List.view(buf.buffer, new_offset), + ); + final format = format_lifted.value; + new_offset += format_lifted.bytesRead; + final width_lifted = FfiConverterUInt32.read( + Uint8List.view(buf.buffer, new_offset), + ); + final width = width_lifted.value; + new_offset += width_lifted.bytesRead; + final height_lifted = FfiConverterUInt32.read( + Uint8List.view(buf.buffer, new_offset), + ); + final height = height_lifted.value; + new_offset += height_lifted.bytesRead; + final framerate_lifted = FfiConverterUInt32.read( + Uint8List.view(buf.buffer, new_offset), + ); + final framerate = framerate_lifted.value; + new_offset += framerate_lifted.bytesRead; + return LiftRetVal( + MoqVideoEncoderInput( + format: format, + width: width, + height: height, + framerate: framerate, + ), + new_offset - buf.offsetInBytes, + ); + } + + static RustBuffer lower(MoqVideoEncoderInput value) { + final total_length = + FfiConverterMoqVideoPixelFormat.allocationSize(value.format) + + FfiConverterUInt32.allocationSize(value.width) + + FfiConverterUInt32.allocationSize(value.height) + + FfiConverterUInt32.allocationSize(value.framerate) + + 0; + final buf = Uint8List(total_length); + write(value, buf); + return toRustBuffer(buf); + } + + static int write(MoqVideoEncoderInput value, Uint8List buf) { + int new_offset = buf.offsetInBytes; + new_offset += FfiConverterMoqVideoPixelFormat.write( + value.format, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterUInt32.write( + value.width, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterUInt32.write( + value.height, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterUInt32.write( + value.framerate, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset - buf.offsetInBytes; + } + + static int allocationSize(MoqVideoEncoderInput value) { + return FfiConverterMoqVideoPixelFormat.allocationSize(value.format) + + FfiConverterUInt32.allocationSize(value.width) + + FfiConverterUInt32.allocationSize(value.height) + + FfiConverterUInt32.allocationSize(value.framerate) + + 0; + } +} + +class MoqVideoEncoderOutput { + final MoqVideoCodec codec; + final String? track; + final int? bitrate; + final MoqVideoGop? gop; + final MoqVideoEncoderKind kind; + MoqVideoEncoderOutput({ + required this.codec, + this.track = null, + this.bitrate = null, + this.gop = null, + required this.kind, + }); +} + +class FfiConverterMoqVideoEncoderOutput { + static MoqVideoEncoderOutput lift(RustBuffer buf) { + return FfiConverterMoqVideoEncoderOutput.read(buf.asUint8List()).value; + } + + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final codec_lifted = FfiConverterMoqVideoCodec.read( + Uint8List.view(buf.buffer, new_offset), + ); + final codec = codec_lifted.value; + new_offset += codec_lifted.bytesRead; + final track_lifted = FfiConverterOptionalString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final track = track_lifted.value; + new_offset += track_lifted.bytesRead; + final bitrate_lifted = FfiConverterOptionalUInt64.read( + Uint8List.view(buf.buffer, new_offset), + ); + final bitrate = bitrate_lifted.value; + new_offset += bitrate_lifted.bytesRead; + final gop_lifted = FfiConverterOptionalMoqVideoGop.read( + Uint8List.view(buf.buffer, new_offset), + ); + final gop = gop_lifted.value; + new_offset += gop_lifted.bytesRead; + final kind_lifted = FfiConverterMoqVideoEncoderKind.read( + Uint8List.view(buf.buffer, new_offset), + ); + final kind = kind_lifted.value; + new_offset += kind_lifted.bytesRead; + return LiftRetVal( + MoqVideoEncoderOutput( + codec: codec, + track: track, + bitrate: bitrate, + gop: gop, + kind: kind, + ), + new_offset - buf.offsetInBytes, + ); + } + + static RustBuffer lower(MoqVideoEncoderOutput value) { + final total_length = + FfiConverterMoqVideoCodec.allocationSize(value.codec) + + FfiConverterOptionalString.allocationSize(value.track) + + FfiConverterOptionalUInt64.allocationSize(value.bitrate) + + FfiConverterOptionalMoqVideoGop.allocationSize(value.gop) + + FfiConverterMoqVideoEncoderKind.allocationSize(value.kind) + + 0; + final buf = Uint8List(total_length); + write(value, buf); + return toRustBuffer(buf); + } + + static int write(MoqVideoEncoderOutput value, Uint8List buf) { + int new_offset = buf.offsetInBytes; + new_offset += FfiConverterMoqVideoCodec.write( + value.codec, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalString.write( + value.track, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalUInt64.write( + value.bitrate, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalMoqVideoGop.write( + value.gop, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterMoqVideoEncoderKind.write( + value.kind, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset - buf.offsetInBytes; + } + + static int allocationSize(MoqVideoEncoderOutput value) { + return FfiConverterMoqVideoCodec.allocationSize(value.codec) + + FfiConverterOptionalString.allocationSize(value.track) + + FfiConverterOptionalUInt64.allocationSize(value.bitrate) + + FfiConverterOptionalMoqVideoGop.allocationSize(value.gop) + + FfiConverterMoqVideoEncoderKind.allocationSize(value.kind) + + 0; + } +} + +class MoqVideoFrame { + final int timestampUs; + final Uint8List data; + MoqVideoFrame({required this.timestampUs, required this.data}); +} + +class FfiConverterMoqVideoFrame { + static MoqVideoFrame lift(RustBuffer buf) { + return FfiConverterMoqVideoFrame.read(buf.asUint8List()).value; + } + + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final timestampUs_lifted = FfiConverterUInt64.read( + Uint8List.view(buf.buffer, new_offset), + ); + final timestampUs = timestampUs_lifted.value; + new_offset += timestampUs_lifted.bytesRead; + final data_lifted = FfiConverterUint8List.read( + Uint8List.view(buf.buffer, new_offset), + ); + final data = data_lifted.value; + new_offset += data_lifted.bytesRead; + return LiftRetVal( + MoqVideoFrame(timestampUs: timestampUs, data: data), + new_offset - buf.offsetInBytes, + ); + } + + static RustBuffer lower(MoqVideoFrame value) { + final total_length = + FfiConverterUInt64.allocationSize(value.timestampUs) + + FfiConverterUint8List.allocationSize(value.data) + + 0; + final buf = Uint8List(total_length); + write(value, buf); + return toRustBuffer(buf); + } + + static int write(MoqVideoFrame value, Uint8List buf) { + int new_offset = buf.offsetInBytes; + new_offset += FfiConverterUInt64.write( + value.timestampUs, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterUint8List.write( + value.data, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset - buf.offsetInBytes; + } + + static int allocationSize(MoqVideoFrame value) { + return FfiConverterUInt64.allocationSize(value.timestampUs) + + FfiConverterUint8List.allocationSize(value.data) + + 0; + } +} + +class MoqVideoPacket { + final int timestampUs; + final Uint8List data; + final bool keyframe; + MoqVideoPacket({ + required this.timestampUs, + required this.data, + required this.keyframe, + }); +} + +class FfiConverterMoqVideoPacket { + static MoqVideoPacket lift(RustBuffer buf) { + return FfiConverterMoqVideoPacket.read(buf.asUint8List()).value; + } + + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final timestampUs_lifted = FfiConverterUInt64.read( + Uint8List.view(buf.buffer, new_offset), + ); + final timestampUs = timestampUs_lifted.value; + new_offset += timestampUs_lifted.bytesRead; + final data_lifted = FfiConverterUint8List.read( + Uint8List.view(buf.buffer, new_offset), + ); + final data = data_lifted.value; + new_offset += data_lifted.bytesRead; + final keyframe_lifted = FfiConverterBool.read( + Uint8List.view(buf.buffer, new_offset), + ); + final keyframe = keyframe_lifted.value; + new_offset += keyframe_lifted.bytesRead; + return LiftRetVal( + MoqVideoPacket(timestampUs: timestampUs, data: data, keyframe: keyframe), + new_offset - buf.offsetInBytes, + ); + } + + static RustBuffer lower(MoqVideoPacket value) { + final total_length = + FfiConverterUInt64.allocationSize(value.timestampUs) + + FfiConverterUint8List.allocationSize(value.data) + + FfiConverterBool.allocationSize(value.keyframe) + + 0; + final buf = Uint8List(total_length); + write(value, buf); + return toRustBuffer(buf); + } + + static int write(MoqVideoPacket value, Uint8List buf) { + int new_offset = buf.offsetInBytes; + new_offset += FfiConverterUInt64.write( + value.timestampUs, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterUint8List.write( + value.data, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterBool.write( + value.keyframe, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset - buf.offsetInBytes; + } + + static int allocationSize(MoqVideoPacket value) { + return FfiConverterUInt64.allocationSize(value.timestampUs) + + FfiConverterUint8List.allocationSize(value.data) + + FfiConverterBool.allocationSize(value.keyframe) + + 0; + } +} + +enum MoqAudioPreset { lowLatency, balanced, quality } + +class FfiConverterMoqAudioPreset { + static LiftRetVal read(Uint8List buf) { + final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); + switch (index) { + case 1: + return LiftRetVal(MoqAudioPreset.lowLatency, 4); + case 2: + return LiftRetVal(MoqAudioPreset.balanced, 4); + case 3: + return LiftRetVal(MoqAudioPreset.quality, 4); + default: + throw UniffiInternalError( + UniffiInternalError.unexpectedEnumCase, + "Unable to determine enum variant", + ); + } + } + + static MoqAudioPreset lift(RustBuffer buffer) { + return FfiConverterMoqAudioPreset.read(buffer.asUint8List()).value; + } + + static RustBuffer lower(MoqAudioPreset input) { + return toRustBuffer(createUint8ListFromInt(input.index + 1)); + } + + static int allocationSize(MoqAudioPreset _value) { + return 4; + } + + static int write(MoqAudioPreset value, Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, value.index + 1); + return 4; + } +} + +enum MoqAudioSampleFormat { + u8, + s16, + s32, + f32, + u8Planar, + s16Planar, + s32Planar, + f32Planar, +} + +class FfiConverterMoqAudioSampleFormat { + static LiftRetVal read(Uint8List buf) { + final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); + switch (index) { + case 1: + return LiftRetVal(MoqAudioSampleFormat.u8, 4); + case 2: + return LiftRetVal(MoqAudioSampleFormat.s16, 4); + case 3: + return LiftRetVal(MoqAudioSampleFormat.s32, 4); + case 4: + return LiftRetVal(MoqAudioSampleFormat.f32, 4); + case 5: + return LiftRetVal(MoqAudioSampleFormat.u8Planar, 4); + case 6: + return LiftRetVal(MoqAudioSampleFormat.s16Planar, 4); + case 7: + return LiftRetVal(MoqAudioSampleFormat.s32Planar, 4); + case 8: + return LiftRetVal(MoqAudioSampleFormat.f32Planar, 4); + default: + throw UniffiInternalError( + UniffiInternalError.unexpectedEnumCase, + "Unable to determine enum variant", + ); + } + } + + static MoqAudioSampleFormat lift(RustBuffer buffer) { + return FfiConverterMoqAudioSampleFormat.read(buffer.asUint8List()).value; + } + + static RustBuffer lower(MoqAudioSampleFormat input) { + return toRustBuffer(createUint8ListFromInt(input.index + 1)); + } + + static int allocationSize(MoqAudioSampleFormat _value) { + return 4; + } + + static int write(MoqAudioSampleFormat value, Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, value.index + 1); + return 4; + } +} + +abstract class MoqException implements Exception { + RustBuffer lower(); + int allocationSize(); + int write(Uint8List buf); + @override + String toString() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqerror_uniffi_trait_display( + FfiConverterMoqException.lower(this), + status, + ), + FfiConverterString.lift, + ); + } +} + +class FfiConverterMoqException { + static MoqException lift(RustBuffer buffer) { + return FfiConverterMoqException.read(buffer.asUint8List()).value; + } + + static LiftRetVal read(Uint8List buf) { + final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); + final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); + switch (index) { + case 1: + final lifted = ProtocolMoqException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 2: + final lifted = TransportMoqException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 3: + final lifted = InternalMoqException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 4: + final lifted = MediaMoqException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 5: + final lifted = MuxMoqException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 6: + final lifted = JsonTrackMoqException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 7: + final lifted = AudioMoqException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 8: + final lifted = VideoMoqException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 9: + final lifted = UrlMoqException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 10: + final lifted = TimeOverflowMoqException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 11: + final lifted = LogLevelMoqException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 12: + final lifted = TaskMoqException.read(subview); return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); + case 13: + final lifted = JsonMoqException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 14: + final lifted = CancelledMoqException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 15: + final lifted = ClosedMoqException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 16: + final lifted = BusyMoqException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 17: + final lifted = ConnectMoqException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 18: + final lifted = BindMoqException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 19: + final lifted = RejectMoqException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 20: + final lifted = AlreadyRespondedMoqException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 21: + final lifted = CodecMoqException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 22: + final lifted = UnauthorizedMoqException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 23: + final lifted = ForbiddenMoqException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 24: + final lifted = ExpiredMoqException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 25: + final lifted = NotFoundMoqException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 26: + final lifted = UnsupportedMoqException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 27: + final lifted = AlreadyCommittedMoqException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 28: + final lifted = InvalidRouteMoqException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 29: + final lifted = InvalidPatternMoqException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 30: + final lifted = InvalidEpochMoqException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 31: + final lifted = UnresolvableBroadcastMoqException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 32: + final lifted = LogMoqException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 33: + final lifted = ConfigMoqException.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + default: + throw UniffiInternalError( + UniffiInternalError.unexpectedEnumCase, + "Unable to determine enum variant", + ); + } + } + + static RustBuffer lower(MoqException value) { + return value.lower(); + } + + static int allocationSize(MoqException value) { + return value.allocationSize(); + } + + static int write(MoqException value, Uint8List buf) { + return value.write(buf) - buf.offsetInBytes; + } +} + +class ProtocolMoqException extends MoqException { + final MoqProtocolException details; + ProtocolMoqException(MoqProtocolException this.details); + ProtocolMoqException._(MoqProtocolException this.details); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final details_lifted = FfiConverterMoqProtocolError.read( + Uint8List.view(buf.buffer, new_offset), + ); + final details = details_lifted.value; + new_offset += details_lifted.bytesRead; + return LiftRetVal(ProtocolMoqException._(details), new_offset); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return FfiConverterMoqProtocolError.allocationSize(details) + 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); + int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterMoqProtocolError.write( + details, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset; + } +} + +class TransportMoqException extends MoqException { + final String reason; + TransportMoqException(String this.reason); + TransportMoqException._(String this.reason); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final reason_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final reason = reason_lifted.value; + new_offset += reason_lifted.bytesRead; + return LiftRetVal(TransportMoqException._(reason), new_offset); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return FfiConverterString.allocationSize(reason) + 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 2); + int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterString.write( + reason, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset; + } +} + +class InternalMoqException extends MoqException { + final String reason; + InternalMoqException(String this.reason); + InternalMoqException._(String this.reason); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final reason_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final reason = reason_lifted.value; + new_offset += reason_lifted.bytesRead; + return LiftRetVal(InternalMoqException._(reason), new_offset); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return FfiConverterString.allocationSize(reason) + 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 3); + int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterString.write( + reason, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset; + } +} + +class MediaMoqException extends MoqException { + final String reason; + MediaMoqException(String this.reason); + MediaMoqException._(String this.reason); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final reason_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final reason = reason_lifted.value; + new_offset += reason_lifted.bytesRead; + return LiftRetVal(MediaMoqException._(reason), new_offset); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return FfiConverterString.allocationSize(reason) + 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 4); + int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterString.write( + reason, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset; + } +} + +class MuxMoqException extends MoqException { + final String reason; + MuxMoqException(String this.reason); + MuxMoqException._(String this.reason); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final reason_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final reason = reason_lifted.value; + new_offset += reason_lifted.bytesRead; + return LiftRetVal(MuxMoqException._(reason), new_offset); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return FfiConverterString.allocationSize(reason) + 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 5); + int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterString.write( + reason, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset; + } +} + +class JsonTrackMoqException extends MoqException { + final String reason; + JsonTrackMoqException(String this.reason); + JsonTrackMoqException._(String this.reason); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final reason_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final reason = reason_lifted.value; + new_offset += reason_lifted.bytesRead; + return LiftRetVal(JsonTrackMoqException._(reason), new_offset); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return FfiConverterString.allocationSize(reason) + 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 6); + int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterString.write( + reason, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset; + } +} + +class AudioMoqException extends MoqException { + final String reason; + AudioMoqException(String this.reason); + AudioMoqException._(String this.reason); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final reason_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final reason = reason_lifted.value; + new_offset += reason_lifted.bytesRead; + return LiftRetVal(AudioMoqException._(reason), new_offset); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return FfiConverterString.allocationSize(reason) + 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 7); + int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterString.write( + reason, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset; + } +} + +class VideoMoqException extends MoqException { + final String reason; + VideoMoqException(String this.reason); + VideoMoqException._(String this.reason); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final reason_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final reason = reason_lifted.value; + new_offset += reason_lifted.bytesRead; + return LiftRetVal(VideoMoqException._(reason), new_offset); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return FfiConverterString.allocationSize(reason) + 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 8); + int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterString.write( + reason, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset; + } +} + +class UrlMoqException extends MoqException { + final String reason; + UrlMoqException(String this.reason); + UrlMoqException._(String this.reason); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final reason_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final reason = reason_lifted.value; + new_offset += reason_lifted.bytesRead; + return LiftRetVal(UrlMoqException._(reason), new_offset); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return FfiConverterString.allocationSize(reason) + 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 9); + int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterString.write( + reason, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset; + } +} + +class TimeOverflowMoqException extends MoqException { + TimeOverflowMoqException(); + TimeOverflowMoqException._(); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + return LiftRetVal(TimeOverflowMoqException._(), new_offset); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 10); + int new_offset = buf.offsetInBytes + 4; + return new_offset; + } +} + +class LogLevelMoqException extends MoqException { + final String reason; + LogLevelMoqException(String this.reason); + LogLevelMoqException._(String this.reason); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final reason_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final reason = reason_lifted.value; + new_offset += reason_lifted.bytesRead; + return LiftRetVal(LogLevelMoqException._(reason), new_offset); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return FfiConverterString.allocationSize(reason) + 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 11); + int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterString.write( + reason, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset; + } +} + +class TaskMoqException extends MoqException { + final String reason; + TaskMoqException(String this.reason); + TaskMoqException._(String this.reason); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final reason_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final reason = reason_lifted.value; + new_offset += reason_lifted.bytesRead; + return LiftRetVal(TaskMoqException._(reason), new_offset); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return FfiConverterString.allocationSize(reason) + 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 12); + int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterString.write( + reason, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset; + } +} + +class JsonMoqException extends MoqException { + final String reason; + JsonMoqException(String this.reason); + JsonMoqException._(String this.reason); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final reason_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final reason = reason_lifted.value; + new_offset += reason_lifted.bytesRead; + return LiftRetVal(JsonMoqException._(reason), new_offset); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return FfiConverterString.allocationSize(reason) + 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 13); + int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterString.write( + reason, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset; + } +} + +class CancelledMoqException extends MoqException { + CancelledMoqException(); + CancelledMoqException._(); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + return LiftRetVal(CancelledMoqException._(), new_offset); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 14); + int new_offset = buf.offsetInBytes + 4; + return new_offset; + } +} + +class ClosedMoqException extends MoqException { + ClosedMoqException(); + ClosedMoqException._(); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + return LiftRetVal(ClosedMoqException._(), new_offset); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 15); + int new_offset = buf.offsetInBytes + 4; + return new_offset; + } +} + +class BusyMoqException extends MoqException { + BusyMoqException(); + BusyMoqException._(); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + return LiftRetVal(BusyMoqException._(), new_offset); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 16); + int new_offset = buf.offsetInBytes + 4; + return new_offset; + } +} + +class ConnectMoqException extends MoqException { + final String reason; + ConnectMoqException(String this.reason); + ConnectMoqException._(String this.reason); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final reason_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final reason = reason_lifted.value; + new_offset += reason_lifted.bytesRead; + return LiftRetVal(ConnectMoqException._(reason), new_offset); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return FfiConverterString.allocationSize(reason) + 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 17); + int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterString.write( + reason, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset; + } +} + +class BindMoqException extends MoqException { + final String reason; + BindMoqException(String this.reason); + BindMoqException._(String this.reason); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final reason_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final reason = reason_lifted.value; + new_offset += reason_lifted.bytesRead; + return LiftRetVal(BindMoqException._(reason), new_offset); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return FfiConverterString.allocationSize(reason) + 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 18); + int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterString.write( + reason, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset; + } +} + +class RejectMoqException extends MoqException { + final String reason; + RejectMoqException(String this.reason); + RejectMoqException._(String this.reason); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final reason_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final reason = reason_lifted.value; + new_offset += reason_lifted.bytesRead; + return LiftRetVal(RejectMoqException._(reason), new_offset); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return FfiConverterString.allocationSize(reason) + 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 19); + int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterString.write( + reason, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset; + } +} + +class AlreadyRespondedMoqException extends MoqException { + AlreadyRespondedMoqException(); + AlreadyRespondedMoqException._(); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + return LiftRetVal(AlreadyRespondedMoqException._(), new_offset); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 20); + int new_offset = buf.offsetInBytes + 4; + return new_offset; + } +} + +class CodecMoqException extends MoqException { + final String reason; + CodecMoqException(String this.reason); + CodecMoqException._(String this.reason); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final reason_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final reason = reason_lifted.value; + new_offset += reason_lifted.bytesRead; + return LiftRetVal(CodecMoqException._(reason), new_offset); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return FfiConverterString.allocationSize(reason) + 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 21); + int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterString.write( + reason, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset; + } +} + +class UnauthorizedMoqException extends MoqException { + UnauthorizedMoqException(); + UnauthorizedMoqException._(); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + return LiftRetVal(UnauthorizedMoqException._(), new_offset); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 22); + int new_offset = buf.offsetInBytes + 4; + return new_offset; + } +} + +class ForbiddenMoqException extends MoqException { + ForbiddenMoqException(); + ForbiddenMoqException._(); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + return LiftRetVal(ForbiddenMoqException._(), new_offset); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 23); + int new_offset = buf.offsetInBytes + 4; + return new_offset; + } +} + +class ExpiredMoqException extends MoqException { + ExpiredMoqException(); + ExpiredMoqException._(); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + return LiftRetVal(ExpiredMoqException._(), new_offset); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 24); + int new_offset = buf.offsetInBytes + 4; + return new_offset; + } +} + +class NotFoundMoqException extends MoqException { + NotFoundMoqException(); + NotFoundMoqException._(); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + return LiftRetVal(NotFoundMoqException._(), new_offset); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 25); + int new_offset = buf.offsetInBytes + 4; + return new_offset; + } +} + +class UnsupportedMoqException extends MoqException { + UnsupportedMoqException(); + UnsupportedMoqException._(); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + return LiftRetVal(UnsupportedMoqException._(), new_offset); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 26); + int new_offset = buf.offsetInBytes + 4; + return new_offset; + } +} + +class AlreadyCommittedMoqException extends MoqException { + AlreadyCommittedMoqException(); + AlreadyCommittedMoqException._(); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + return LiftRetVal(AlreadyCommittedMoqException._(), new_offset); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 27); + int new_offset = buf.offsetInBytes + 4; + return new_offset; + } +} + +class InvalidRouteMoqException extends MoqException { + final String reason; + InvalidRouteMoqException(String this.reason); + InvalidRouteMoqException._(String this.reason); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final reason_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final reason = reason_lifted.value; + new_offset += reason_lifted.bytesRead; + return LiftRetVal(InvalidRouteMoqException._(reason), new_offset); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return FfiConverterString.allocationSize(reason) + 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 28); + int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterString.write( + reason, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset; + } +} + +class InvalidPatternMoqException extends MoqException { + final String reason; + InvalidPatternMoqException(String this.reason); + InvalidPatternMoqException._(String this.reason); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final reason_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final reason = reason_lifted.value; + new_offset += reason_lifted.bytesRead; + return LiftRetVal(InvalidPatternMoqException._(reason), new_offset); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return FfiConverterString.allocationSize(reason) + 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 29); + int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterString.write( + reason, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset; + } +} + +class InvalidEpochMoqException extends MoqException { + final String reason; + InvalidEpochMoqException(String this.reason); + InvalidEpochMoqException._(String this.reason); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final reason_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final reason = reason_lifted.value; + new_offset += reason_lifted.bytesRead; + return LiftRetVal(InvalidEpochMoqException._(reason), new_offset); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return FfiConverterString.allocationSize(reason) + 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 30); + int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterString.write( + reason, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset; + } +} + +class UnresolvableBroadcastMoqException extends MoqException { + final String reason; + UnresolvableBroadcastMoqException(String this.reason); + UnresolvableBroadcastMoqException._(String this.reason); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final reason_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final reason = reason_lifted.value; + new_offset += reason_lifted.bytesRead; + return LiftRetVal(UnresolvableBroadcastMoqException._(reason), new_offset); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return FfiConverterString.allocationSize(reason) + 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 31); + int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterString.write( + reason, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset; + } +} + +class LogMoqException extends MoqException { + final String reason; + LogMoqException(String this.reason); + LogMoqException._(String this.reason); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final reason_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final reason = reason_lifted.value; + new_offset += reason_lifted.bytesRead; + return LiftRetVal(LogMoqException._(reason), new_offset); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return FfiConverterString.allocationSize(reason) + 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 32); + int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterString.write( + reason, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset; + } +} + +class ConfigMoqException extends MoqException { + final String reason; + ConfigMoqException(String this.reason); + ConfigMoqException._(String this.reason); + static LiftRetVal read(Uint8List buf) { + int new_offset = buf.offsetInBytes; + final reason_lifted = FfiConverterString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final reason = reason_lifted.value; + new_offset += reason_lifted.bytesRead; + return LiftRetVal(ConfigMoqException._(reason), new_offset); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return FfiConverterString.allocationSize(reason) + 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 33); + int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterString.write( + reason, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset; + } +} + +class MoqExceptionErrorHandler extends UniffiRustCallStatusErrorHandler { + @override + Exception lift(RustBuffer errorBuf) { + return FfiConverterMoqException.lift(errorBuf); + } +} + +final MoqExceptionErrorHandler moqExceptionErrorHandler = + MoqExceptionErrorHandler(); + +enum MoqErrorScope { session, stream } + +class FfiConverterMoqErrorScope { + static LiftRetVal read(Uint8List buf) { + final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); + switch (index) { + case 1: + return LiftRetVal(MoqErrorScope.session, 4); case 2: - final lifted = TransportMoqException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, + return LiftRetVal(MoqErrorScope.stream, 4); + default: + throw UniffiInternalError( + UniffiInternalError.unexpectedEnumCase, + "Unable to determine enum variant", ); + } + } + + static MoqErrorScope lift(RustBuffer buffer) { + return FfiConverterMoqErrorScope.read(buffer.asUint8List()).value; + } + + static RustBuffer lower(MoqErrorScope input) { + return toRustBuffer(createUint8ListFromInt(input.index + 1)); + } + + static int allocationSize(MoqErrorScope _value) { + return 4; + } + + static int write(MoqErrorScope value, Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, value.index + 1); + return 4; + } +} + +enum MoqProtocolKind { + cancel, + internal, + unauthorized, + protocolViolation, + keyValueFormatting, + goawayTimeout, + timeout, + version, + deliveryTimeout, + sessionClosed, + goingAway, + tooFarBehind, + malformedTrack, + notFound, + unroutable, + old, + evicted, + wrongSize, + frameTooLarge, + timestampMismatch, + app, + unknown, + tooManyRequests, + expired, +} + +class FfiConverterMoqProtocolKind { + static LiftRetVal read(Uint8List buf) { + final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); + switch (index) { + case 1: + return LiftRetVal(MoqProtocolKind.cancel, 4); + case 2: + return LiftRetVal(MoqProtocolKind.internal, 4); case 3: - final lifted = InternalMoqException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); + return LiftRetVal(MoqProtocolKind.unauthorized, 4); case 4: - final lifted = MediaMoqException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); + return LiftRetVal(MoqProtocolKind.protocolViolation, 4); case 5: - final lifted = MuxMoqException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); + return LiftRetVal(MoqProtocolKind.keyValueFormatting, 4); case 6: - final lifted = JsonTrackMoqException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); + return LiftRetVal(MoqProtocolKind.goawayTimeout, 4); case 7: - final lifted = UrlMoqException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); + return LiftRetVal(MoqProtocolKind.timeout, 4); case 8: - final lifted = TimeOverflowMoqException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); + return LiftRetVal(MoqProtocolKind.version, 4); case 9: - final lifted = LogLevelMoqException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); + return LiftRetVal(MoqProtocolKind.deliveryTimeout, 4); case 10: - final lifted = TaskMoqException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); + return LiftRetVal(MoqProtocolKind.sessionClosed, 4); case 11: - final lifted = JsonMoqException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); + return LiftRetVal(MoqProtocolKind.goingAway, 4); case 12: - final lifted = CancelledMoqException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); + return LiftRetVal(MoqProtocolKind.tooFarBehind, 4); case 13: - final lifted = ClosedMoqException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); + return LiftRetVal(MoqProtocolKind.malformedTrack, 4); case 14: - final lifted = BusyMoqException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); + return LiftRetVal(MoqProtocolKind.notFound, 4); case 15: - final lifted = ConnectMoqException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); + return LiftRetVal(MoqProtocolKind.unroutable, 4); case 16: - final lifted = BindMoqException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); + return LiftRetVal(MoqProtocolKind.old, 4); case 17: - final lifted = RejectMoqException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); + return LiftRetVal(MoqProtocolKind.evicted, 4); case 18: - final lifted = AlreadyRespondedMoqException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); + return LiftRetVal(MoqProtocolKind.wrongSize, 4); case 19: - final lifted = CodecMoqException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); + return LiftRetVal(MoqProtocolKind.frameTooLarge, 4); case 20: - final lifted = UnauthorizedMoqException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); + return LiftRetVal(MoqProtocolKind.timestampMismatch, 4); case 21: - final lifted = ForbiddenMoqException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); + return LiftRetVal(MoqProtocolKind.app, 4); case 22: - final lifted = ExpiredMoqException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); + return LiftRetVal(MoqProtocolKind.unknown, 4); case 23: - final lifted = NotFoundMoqException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); + return LiftRetVal(MoqProtocolKind.tooManyRequests, 4); case 24: - final lifted = UnsupportedMoqException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 25: - final lifted = AlreadyCommittedMoqException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 26: - final lifted = InvalidRouteMoqException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 27: - final lifted = InvalidPatternMoqException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 28: - final lifted = InvalidEpochMoqException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 29: - final lifted = UnresolvableBroadcastMoqException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 30: - final lifted = LogMoqException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 31: - final lifted = ConfigMoqException.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); + return LiftRetVal(MoqProtocolKind.expired, 4); default: throw UniffiInternalError( UniffiInternalError.unexpectedEnumCase, @@ -3231,107 +5508,124 @@ class FfiConverterMoqException { } } - static RustBuffer lower(MoqException value) { - return value.lower(); + static MoqProtocolKind lift(RustBuffer buffer) { + return FfiConverterMoqProtocolKind.read(buffer.asUint8List()).value; } - static int allocationSize(MoqException value) { - return value.allocationSize(); + static RustBuffer lower(MoqProtocolKind input) { + return toRustBuffer(createUint8ListFromInt(input.index + 1)); } - static int write(MoqException value, Uint8List buf) { - return value.write(buf) - buf.offsetInBytes; + static int allocationSize(MoqProtocolKind _value) { + return 4; + } + + static int write(MoqProtocolKind value, Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, value.index + 1); + return 4; } } -class ProtocolMoqException extends MoqException { - final MoqProtocolException details; - ProtocolMoqException(MoqProtocolException this.details); - ProtocolMoqException._(MoqProtocolException this.details); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final details_lifted = FfiConverterMoqProtocolError.read( - Uint8List.view(buf.buffer, new_offset), - ); - final details = details_lifted.value; - new_offset += details_lifted.bytesRead; - return LiftRetVal(ProtocolMoqException._(details), new_offset); +enum MoqAudioFormat { aac, opus, flac, mp3 } + +class FfiConverterMoqAudioFormat { + static LiftRetVal read(Uint8List buf) { + final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); + switch (index) { + case 1: + return LiftRetVal(MoqAudioFormat.aac, 4); + case 2: + return LiftRetVal(MoqAudioFormat.opus, 4); + case 3: + return LiftRetVal(MoqAudioFormat.flac, 4); + case 4: + return LiftRetVal(MoqAudioFormat.mp3, 4); + default: + throw UniffiInternalError( + UniffiInternalError.unexpectedEnumCase, + "Unable to determine enum variant", + ); + } } - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); + static MoqAudioFormat lift(RustBuffer buffer) { + return FfiConverterMoqAudioFormat.read(buffer.asUint8List()).value; } - @override - int allocationSize() { - return FfiConverterMoqProtocolError.allocationSize(details) + 4; + static RustBuffer lower(MoqAudioFormat input) { + return toRustBuffer(createUint8ListFromInt(input.index + 1)); } - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); - int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterMoqProtocolError.write( - details, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset; + static int allocationSize(MoqAudioFormat _value) { + return 4; + } + + static int write(MoqAudioFormat value, Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, value.index + 1); + return 4; } } -class TransportMoqException extends MoqException { - final String reason; - TransportMoqException(String this.reason); - TransportMoqException._(String this.reason); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final reason_lifted = FfiConverterString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final reason = reason_lifted.value; - new_offset += reason_lifted.bytesRead; - return LiftRetVal(TransportMoqException._(reason), new_offset); +abstract class MoqContainer { + RustBuffer lower(); + int allocationSize(); + int write(Uint8List buf); +} + +class FfiConverterMoqContainer { + static MoqContainer lift(RustBuffer buffer) { + return FfiConverterMoqContainer.read(buffer.asUint8List()).value; } - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); + static LiftRetVal read(Uint8List buf) { + final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); + final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); + switch (index) { + case 1: + final lifted = LegacyMoqContainer.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 2: + final lifted = CmafMoqContainer.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 3: + final lifted = LocMoqContainer.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + default: + throw UniffiInternalError( + UniffiInternalError.unexpectedEnumCase, + "Unable to determine enum variant", + ); + } } - @override - int allocationSize() { - return FfiConverterString.allocationSize(reason) + 4; + static RustBuffer lower(MoqContainer value) { + return value.lower(); } - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 2); - int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - reason, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset; + static int allocationSize(MoqContainer value) { + return value.allocationSize(); + } + + static int write(MoqContainer value, Uint8List buf) { + return value.write(buf) - buf.offsetInBytes; } } -class InternalMoqException extends MoqException { - final String reason; - InternalMoqException(String this.reason); - InternalMoqException._(String this.reason); - static LiftRetVal read(Uint8List buf) { +class LegacyMoqContainer extends MoqContainer { + LegacyMoqContainer(); + LegacyMoqContainer._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final reason_lifted = FfiConverterString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final reason = reason_lifted.value; - new_offset += reason_lifted.bytesRead; - return LiftRetVal(InternalMoqException._(reason), new_offset); + return LiftRetVal(LegacyMoqContainer._(), new_offset); } @override @@ -3343,33 +5637,29 @@ class InternalMoqException extends MoqException { @override int allocationSize() { - return FfiConverterString.allocationSize(reason) + 4; + return 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 3); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - reason, - Uint8List.view(buf.buffer, new_offset), - ); return new_offset; } } -class MediaMoqException extends MoqException { - final String reason; - MediaMoqException(String this.reason); - MediaMoqException._(String this.reason); - static LiftRetVal read(Uint8List buf) { +class CmafMoqContainer extends MoqContainer { + final Uint8List init; + CmafMoqContainer(Uint8List this.init); + CmafMoqContainer._(Uint8List this.init); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final reason_lifted = FfiConverterString.read( + final init_lifted = FfiConverterUint8List.read( Uint8List.view(buf.buffer, new_offset), ); - final reason = reason_lifted.value; - new_offset += reason_lifted.bytesRead; - return LiftRetVal(MediaMoqException._(reason), new_offset); + final init = init_lifted.value; + new_offset += init_lifted.bytesRead; + return LiftRetVal(CmafMoqContainer._(init), new_offset); } @override @@ -3381,33 +5671,27 @@ class MediaMoqException extends MoqException { @override int allocationSize() { - return FfiConverterString.allocationSize(reason) + 4; + return FfiConverterUint8List.allocationSize(init) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 4); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 2); int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - reason, + new_offset += FfiConverterUint8List.write( + init, Uint8List.view(buf.buffer, new_offset), ); return new_offset; } } -class MuxMoqException extends MoqException { - final String reason; - MuxMoqException(String this.reason); - MuxMoqException._(String this.reason); - static LiftRetVal read(Uint8List buf) { +class LocMoqContainer extends MoqContainer { + LocMoqContainer(); + LocMoqContainer._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final reason_lifted = FfiConverterString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final reason = reason_lifted.value; - new_offset += reason_lifted.bytesRead; - return LiftRetVal(MuxMoqException._(reason), new_offset); + return LiftRetVal(LocMoqContainer._(), new_offset); } @override @@ -3419,103 +5703,117 @@ class MuxMoqException extends MoqException { @override int allocationSize() { - return FfiConverterString.allocationSize(reason) + 4; + return 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 5); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 3); int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - reason, - Uint8List.view(buf.buffer, new_offset), - ); return new_offset; } } -class JsonTrackMoqException extends MoqException { - final String reason; - JsonTrackMoqException(String this.reason); - JsonTrackMoqException._(String this.reason); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final reason_lifted = FfiConverterString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final reason = reason_lifted.value; - new_offset += reason_lifted.bytesRead; - return LiftRetVal(JsonTrackMoqException._(reason), new_offset); +enum MoqContainerFormat { fmp4, mkv, ts, flv } + +class FfiConverterMoqContainerFormat { + static LiftRetVal read(Uint8List buf) { + final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); + switch (index) { + case 1: + return LiftRetVal(MoqContainerFormat.fmp4, 4); + case 2: + return LiftRetVal(MoqContainerFormat.mkv, 4); + case 3: + return LiftRetVal(MoqContainerFormat.ts, 4); + case 4: + return LiftRetVal(MoqContainerFormat.flv, 4); + default: + throw UniffiInternalError( + UniffiInternalError.unexpectedEnumCase, + "Unable to determine enum variant", + ); + } } - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); + static MoqContainerFormat lift(RustBuffer buffer) { + return FfiConverterMoqContainerFormat.read(buffer.asUint8List()).value; } - @override - int allocationSize() { - return FfiConverterString.allocationSize(reason) + 4; + static RustBuffer lower(MoqContainerFormat input) { + return toRustBuffer(createUint8ListFromInt(input.index + 1)); } - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 6); - int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - reason, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset; + static int allocationSize(MoqContainerFormat _value) { + return 4; + } + + static int write(MoqContainerFormat value, Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, value.index + 1); + return 4; } } -class UrlMoqException extends MoqException { - final String reason; - UrlMoqException(String this.reason); - UrlMoqException._(String this.reason); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final reason_lifted = FfiConverterString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final reason = reason_lifted.value; - new_offset += reason_lifted.bytesRead; - return LiftRetVal(UrlMoqException._(reason), new_offset); +abstract class MoqMediaTarget { + RustBuffer lower(); + int allocationSize(); + int write(Uint8List buf); +} + +class FfiConverterMoqMediaTarget { + static MoqMediaTarget lift(RustBuffer buffer) { + return FfiConverterMoqMediaTarget.read(buffer.asUint8List()).value; } - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); + static LiftRetVal read(Uint8List buf) { + final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); + final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); + switch (index) { + case 1: + final lifted = NamedMoqMediaTarget.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 2: + final lifted = RequestedMoqMediaTarget.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + default: + throw UniffiInternalError( + UniffiInternalError.unexpectedEnumCase, + "Unable to determine enum variant", + ); + } } - @override - int allocationSize() { - return FfiConverterString.allocationSize(reason) + 4; + static RustBuffer lower(MoqMediaTarget value) { + return value.lower(); } - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 7); - int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - reason, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset; + static int allocationSize(MoqMediaTarget value) { + return value.allocationSize(); + } + + static int write(MoqMediaTarget value, Uint8List buf) { + return value.write(buf) - buf.offsetInBytes; } } -class TimeOverflowMoqException extends MoqException { - TimeOverflowMoqException(); - TimeOverflowMoqException._(); - static LiftRetVal read(Uint8List buf) { +class NamedMoqMediaTarget extends MoqMediaTarget { + final String? name; + NamedMoqMediaTarget(String? this.name); + NamedMoqMediaTarget._(String? this.name); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(TimeOverflowMoqException._(), new_offset); + final name_lifted = FfiConverterOptionalString.read( + Uint8List.view(buf.buffer, new_offset), + ); + final name = name_lifted.value; + new_offset += name_lifted.bytesRead; + return LiftRetVal(NamedMoqMediaTarget._(name), new_offset); } @override @@ -3527,29 +5825,33 @@ class TimeOverflowMoqException extends MoqException { @override int allocationSize() { - return 4; + return FfiConverterOptionalString.allocationSize(name) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 8); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); int new_offset = buf.offsetInBytes + 4; - return new_offset; - } -} - -class LogLevelMoqException extends MoqException { - final String reason; - LogLevelMoqException(String this.reason); - LogLevelMoqException._(String this.reason); - static LiftRetVal read(Uint8List buf) { + new_offset += FfiConverterOptionalString.write( + name, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset; + } +} + +class RequestedMoqMediaTarget extends MoqMediaTarget { + final MoqTrackRequest request; + RequestedMoqMediaTarget(MoqTrackRequest this.request); + RequestedMoqMediaTarget._(MoqTrackRequest this.request); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final reason_lifted = FfiConverterString.read( + final request_lifted = FfiConverterMoqTrackRequest.read( Uint8List.view(buf.buffer, new_offset), ); - final reason = reason_lifted.value; - new_offset += reason_lifted.bytesRead; - return LiftRetVal(LogLevelMoqException._(reason), new_offset); + final request = request_lifted.value; + new_offset += request_lifted.bytesRead; + return LiftRetVal(RequestedMoqMediaTarget._(request), new_offset); } @override @@ -3561,33 +5863,87 @@ class LogLevelMoqException extends MoqException { @override int allocationSize() { - return FfiConverterString.allocationSize(reason) + 4; + return FfiConverterMoqTrackRequest.allocationSize(request) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 9); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 2); int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - reason, + new_offset += FfiConverterMoqTrackRequest.write( + request, Uint8List.view(buf.buffer, new_offset), ); return new_offset; } } -class TaskMoqException extends MoqException { - final String reason; - TaskMoqException(String this.reason); - TaskMoqException._(String this.reason); - static LiftRetVal read(Uint8List buf) { +abstract class MoqRendition { + RustBuffer lower(); + int allocationSize(); + int write(Uint8List buf); +} + +class FfiConverterMoqRendition { + static MoqRendition lift(RustBuffer buffer) { + return FfiConverterMoqRendition.read(buffer.asUint8List()).value; + } + + static LiftRetVal read(Uint8List buf) { + final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); + final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); + switch (index) { + case 1: + final lifted = VideoMoqRendition.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 2: + final lifted = AudioMoqRendition.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + default: + throw UniffiInternalError( + UniffiInternalError.unexpectedEnumCase, + "Unable to determine enum variant", + ); + } + } + + static RustBuffer lower(MoqRendition value) { + return value.lower(); + } + + static int allocationSize(MoqRendition value) { + return value.allocationSize(); + } + + static int write(MoqRendition value, Uint8List buf) { + return value.write(buf) - buf.offsetInBytes; + } +} + +class VideoMoqRendition extends MoqRendition { + final String id; + final MoqVideo config; + VideoMoqRendition({required String this.id, required MoqVideo this.config}); + VideoMoqRendition._(String this.id, MoqVideo this.config); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final reason_lifted = FfiConverterString.read( + final id_lifted = FfiConverterString.read( Uint8List.view(buf.buffer, new_offset), ); - final reason = reason_lifted.value; - new_offset += reason_lifted.bytesRead; - return LiftRetVal(TaskMoqException._(reason), new_offset); + final id = id_lifted.value; + new_offset += id_lifted.bytesRead; + final config_lifted = FfiConverterMoqVideo.read( + Uint8List.view(buf.buffer, new_offset), + ); + final config = config_lifted.value; + new_offset += config_lifted.bytesRead; + return LiftRetVal(VideoMoqRendition._(id, config), new_offset); } @override @@ -3599,33 +5955,45 @@ class TaskMoqException extends MoqException { @override int allocationSize() { - return FfiConverterString.allocationSize(reason) + 4; + return FfiConverterString.allocationSize(id) + + FfiConverterMoqVideo.allocationSize(config) + + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 10); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); int new_offset = buf.offsetInBytes + 4; new_offset += FfiConverterString.write( - reason, + id, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterMoqVideo.write( + config, Uint8List.view(buf.buffer, new_offset), ); return new_offset; } } -class JsonMoqException extends MoqException { - final String reason; - JsonMoqException(String this.reason); - JsonMoqException._(String this.reason); - static LiftRetVal read(Uint8List buf) { +class AudioMoqRendition extends MoqRendition { + final String id; + final MoqAudio config; + AudioMoqRendition({required String this.id, required MoqAudio this.config}); + AudioMoqRendition._(String this.id, MoqAudio this.config); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final reason_lifted = FfiConverterString.read( + final id_lifted = FfiConverterString.read( Uint8List.view(buf.buffer, new_offset), ); - final reason = reason_lifted.value; - new_offset += reason_lifted.bytesRead; - return LiftRetVal(JsonMoqException._(reason), new_offset); + final id = id_lifted.value; + new_offset += id_lifted.bytesRead; + final config_lifted = FfiConverterMoqAudio.read( + Uint8List.view(buf.buffer, new_offset), + ); + final config = config_lifted.value; + new_offset += config_lifted.bytesRead; + return LiftRetVal(AudioMoqRendition._(id, config), new_offset); } @override @@ -3637,83 +6005,145 @@ class JsonMoqException extends MoqException { @override int allocationSize() { - return FfiConverterString.allocationSize(reason) + 4; + return FfiConverterString.allocationSize(id) + + FfiConverterMoqAudio.allocationSize(config) + + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 11); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 2); int new_offset = buf.offsetInBytes + 4; new_offset += FfiConverterString.write( - reason, + id, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterMoqAudio.write( + config, Uint8List.view(buf.buffer, new_offset), ); return new_offset; } } -class CancelledMoqException extends MoqException { - CancelledMoqException(); - CancelledMoqException._(); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - return LiftRetVal(CancelledMoqException._(), new_offset); +enum MoqVideoFormat { avc1, avc3, hvc1, hev1, av01, vp8, vp9 } + +class FfiConverterMoqVideoFormat { + static LiftRetVal read(Uint8List buf) { + final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); + switch (index) { + case 1: + return LiftRetVal(MoqVideoFormat.avc1, 4); + case 2: + return LiftRetVal(MoqVideoFormat.avc3, 4); + case 3: + return LiftRetVal(MoqVideoFormat.hvc1, 4); + case 4: + return LiftRetVal(MoqVideoFormat.hev1, 4); + case 5: + return LiftRetVal(MoqVideoFormat.av01, 4); + case 6: + return LiftRetVal(MoqVideoFormat.vp8, 4); + case 7: + return LiftRetVal(MoqVideoFormat.vp9, 4); + default: + throw UniffiInternalError( + UniffiInternalError.unexpectedEnumCase, + "Unable to determine enum variant", + ); + } } - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); + static MoqVideoFormat lift(RustBuffer buffer) { + return FfiConverterMoqVideoFormat.read(buffer.asUint8List()).value; } - @override - int allocationSize() { + static RustBuffer lower(MoqVideoFormat input) { + return toRustBuffer(createUint8ListFromInt(input.index + 1)); + } + + static int allocationSize(MoqVideoFormat _value) { return 4; } - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 12); - int new_offset = buf.offsetInBytes + 4; - return new_offset; + static int write(MoqVideoFormat value, Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, value.index + 1); + return 4; } } -class ClosedMoqException extends MoqException { - ClosedMoqException(); - ClosedMoqException._(); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - return LiftRetVal(ClosedMoqException._(), new_offset); +abstract class MoqAnnounceEvent { + RustBuffer lower(); + int allocationSize(); + int write(Uint8List buf); +} + +class FfiConverterMoqAnnounceEvent { + static MoqAnnounceEvent lift(RustBuffer buffer) { + return FfiConverterMoqAnnounceEvent.read(buffer.asUint8List()).value; } - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); + static LiftRetVal read(Uint8List buf) { + final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); + final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); + switch (index) { + case 1: + final lifted = StartMoqAnnounceEvent.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 2: + final lifted = UpdateMoqAnnounceEvent.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 3: + final lifted = EndMoqAnnounceEvent.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 4: + final lifted = RestartMoqAnnounceEvent.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + default: + throw UniffiInternalError( + UniffiInternalError.unexpectedEnumCase, + "Unable to determine enum variant", + ); + } + } + + static RustBuffer lower(MoqAnnounceEvent value) { + return value.lower(); } - @override - int allocationSize() { - return 4; + static int allocationSize(MoqAnnounceEvent value) { + return value.allocationSize(); } - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 13); - int new_offset = buf.offsetInBytes + 4; - return new_offset; + static int write(MoqAnnounceEvent value, Uint8List buf) { + return value.write(buf) - buf.offsetInBytes; } } -class BusyMoqException extends MoqException { - BusyMoqException(); - BusyMoqException._(); - static LiftRetVal read(Uint8List buf) { +class StartMoqAnnounceEvent extends MoqAnnounceEvent { + final MoqAnnounce announce; + StartMoqAnnounceEvent(MoqAnnounce this.announce); + StartMoqAnnounceEvent._(MoqAnnounce this.announce); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(BusyMoqException._(), new_offset); + final announce_lifted = FfiConverterMoqAnnounce.read( + Uint8List.view(buf.buffer, new_offset), + ); + final announce = announce_lifted.value; + new_offset += announce_lifted.bytesRead; + return LiftRetVal(StartMoqAnnounceEvent._(announce), new_offset); } @override @@ -3725,29 +6155,33 @@ class BusyMoqException extends MoqException { @override int allocationSize() { - return 4; + return FfiConverterMoqAnnounce.allocationSize(announce) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 14); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterMoqAnnounce.write( + announce, + Uint8List.view(buf.buffer, new_offset), + ); return new_offset; } } -class ConnectMoqException extends MoqException { - final String reason; - ConnectMoqException(String this.reason); - ConnectMoqException._(String this.reason); - static LiftRetVal read(Uint8List buf) { +class UpdateMoqAnnounceEvent extends MoqAnnounceEvent { + final MoqAnnounce announce; + UpdateMoqAnnounceEvent(MoqAnnounce this.announce); + UpdateMoqAnnounceEvent._(MoqAnnounce this.announce); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final reason_lifted = FfiConverterString.read( + final announce_lifted = FfiConverterMoqAnnounce.read( Uint8List.view(buf.buffer, new_offset), ); - final reason = reason_lifted.value; - new_offset += reason_lifted.bytesRead; - return LiftRetVal(ConnectMoqException._(reason), new_offset); + final announce = announce_lifted.value; + new_offset += announce_lifted.bytesRead; + return LiftRetVal(UpdateMoqAnnounceEvent._(announce), new_offset); } @override @@ -3759,33 +6193,33 @@ class ConnectMoqException extends MoqException { @override int allocationSize() { - return FfiConverterString.allocationSize(reason) + 4; + return FfiConverterMoqAnnounce.allocationSize(announce) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 15); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 2); int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - reason, + new_offset += FfiConverterMoqAnnounce.write( + announce, Uint8List.view(buf.buffer, new_offset), ); return new_offset; } } -class BindMoqException extends MoqException { - final String reason; - BindMoqException(String this.reason); - BindMoqException._(String this.reason); - static LiftRetVal read(Uint8List buf) { +class EndMoqAnnounceEvent extends MoqAnnounceEvent { + final MoqAnnounce announce; + EndMoqAnnounceEvent(MoqAnnounce this.announce); + EndMoqAnnounceEvent._(MoqAnnounce this.announce); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final reason_lifted = FfiConverterString.read( + final announce_lifted = FfiConverterMoqAnnounce.read( Uint8List.view(buf.buffer, new_offset), ); - final reason = reason_lifted.value; - new_offset += reason_lifted.bytesRead; - return LiftRetVal(BindMoqException._(reason), new_offset); + final announce = announce_lifted.value; + new_offset += announce_lifted.bytesRead; + return LiftRetVal(EndMoqAnnounceEvent._(announce), new_offset); } @override @@ -3797,33 +6231,33 @@ class BindMoqException extends MoqException { @override int allocationSize() { - return FfiConverterString.allocationSize(reason) + 4; + return FfiConverterMoqAnnounce.allocationSize(announce) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 16); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 3); int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - reason, + new_offset += FfiConverterMoqAnnounce.write( + announce, Uint8List.view(buf.buffer, new_offset), ); return new_offset; } } -class RejectMoqException extends MoqException { - final String reason; - RejectMoqException(String this.reason); - RejectMoqException._(String this.reason); - static LiftRetVal read(Uint8List buf) { +class RestartMoqAnnounceEvent extends MoqAnnounceEvent { + final MoqAnnounce announce; + RestartMoqAnnounceEvent(MoqAnnounce this.announce); + RestartMoqAnnounceEvent._(MoqAnnounce this.announce); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final reason_lifted = FfiConverterString.read( + final announce_lifted = FfiConverterMoqAnnounce.read( Uint8List.view(buf.buffer, new_offset), ); - final reason = reason_lifted.value; - new_offset += reason_lifted.bytesRead; - return LiftRetVal(RejectMoqException._(reason), new_offset); + final announce = announce_lifted.value; + new_offset += announce_lifted.bytesRead; + return LiftRetVal(RestartMoqAnnounceEvent._(announce), new_offset); } @override @@ -3835,177 +6269,205 @@ class RejectMoqException extends MoqException { @override int allocationSize() { - return FfiConverterString.allocationSize(reason) + 4; + return FfiConverterMoqAnnounce.allocationSize(announce) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 17); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 4); int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - reason, + new_offset += FfiConverterMoqAnnounce.write( + announce, Uint8List.view(buf.buffer, new_offset), ); return new_offset; } } -class AlreadyRespondedMoqException extends MoqException { - AlreadyRespondedMoqException(); - AlreadyRespondedMoqException._(); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - return LiftRetVal(AlreadyRespondedMoqException._(), new_offset); - } +enum MoqTransport { quic, iroh, webSocket, tcp, unix, webTransport } - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); +class FfiConverterMoqTransport { + static LiftRetVal read(Uint8List buf) { + final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); + switch (index) { + case 1: + return LiftRetVal(MoqTransport.quic, 4); + case 2: + return LiftRetVal(MoqTransport.iroh, 4); + case 3: + return LiftRetVal(MoqTransport.webSocket, 4); + case 4: + return LiftRetVal(MoqTransport.tcp, 4); + case 5: + return LiftRetVal(MoqTransport.unix, 4); + case 6: + return LiftRetVal(MoqTransport.webTransport, 4); + default: + throw UniffiInternalError( + UniffiInternalError.unexpectedEnumCase, + "Unable to determine enum variant", + ); + } } - @override - int allocationSize() { - return 4; + static MoqTransport lift(RustBuffer buffer) { + return FfiConverterMoqTransport.read(buffer.asUint8List()).value; } - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 18); - int new_offset = buf.offsetInBytes + 4; - return new_offset; + static RustBuffer lower(MoqTransport input) { + return toRustBuffer(createUint8ListFromInt(input.index + 1)); } -} -class CodecMoqException extends MoqException { - final String reason; - CodecMoqException(String this.reason); - CodecMoqException._(String this.reason); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final reason_lifted = FfiConverterString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final reason = reason_lifted.value; - new_offset += reason_lifted.bytesRead; - return LiftRetVal(CodecMoqException._(reason), new_offset); + static int allocationSize(MoqTransport _value) { + return 4; } - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); + static int write(MoqTransport value, Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, value.index + 1); + return 4; } +} - @override - int allocationSize() { - return FfiConverterString.allocationSize(reason) + 4; - } +enum MoqConnectionStatus { connected, disconnected, migrating } - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 19); - int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - reason, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset; +class FfiConverterMoqConnectionStatus { + static LiftRetVal read(Uint8List buf) { + final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); + switch (index) { + case 1: + return LiftRetVal(MoqConnectionStatus.connected, 4); + case 2: + return LiftRetVal(MoqConnectionStatus.disconnected, 4); + case 3: + return LiftRetVal(MoqConnectionStatus.migrating, 4); + default: + throw UniffiInternalError( + UniffiInternalError.unexpectedEnumCase, + "Unable to determine enum variant", + ); + } } -} -class UnauthorizedMoqException extends MoqException { - UnauthorizedMoqException(); - UnauthorizedMoqException._(); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - return LiftRetVal(UnauthorizedMoqException._(), new_offset); + static MoqConnectionStatus lift(RustBuffer buffer) { + return FfiConverterMoqConnectionStatus.read(buffer.asUint8List()).value; } - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); + static RustBuffer lower(MoqConnectionStatus input) { + return toRustBuffer(createUint8ListFromInt(input.index + 1)); } - @override - int allocationSize() { + static int allocationSize(MoqConnectionStatus _value) { return 4; } - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 20); - int new_offset = buf.offsetInBytes + 4; - return new_offset; + static int write(MoqConnectionStatus value, Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, value.index + 1); + return 4; } } -class ForbiddenMoqException extends MoqException { - ForbiddenMoqException(); - ForbiddenMoqException._(); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - return LiftRetVal(ForbiddenMoqException._(), new_offset); +enum MoqVideoCodec { h264, h265 } + +class FfiConverterMoqVideoCodec { + static LiftRetVal read(Uint8List buf) { + final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); + switch (index) { + case 1: + return LiftRetVal(MoqVideoCodec.h264, 4); + case 2: + return LiftRetVal(MoqVideoCodec.h265, 4); + default: + throw UniffiInternalError( + UniffiInternalError.unexpectedEnumCase, + "Unable to determine enum variant", + ); + } + } + + static MoqVideoCodec lift(RustBuffer buffer) { + return FfiConverterMoqVideoCodec.read(buffer.asUint8List()).value; } - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); + static RustBuffer lower(MoqVideoCodec input) { + return toRustBuffer(createUint8ListFromInt(input.index + 1)); } - @override - int allocationSize() { + static int allocationSize(MoqVideoCodec _value) { return 4; } - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 21); - int new_offset = buf.offsetInBytes + 4; - return new_offset; + static int write(MoqVideoCodec value, Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, value.index + 1); + return 4; } } -class ExpiredMoqException extends MoqException { - ExpiredMoqException(); - ExpiredMoqException._(); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - return LiftRetVal(ExpiredMoqException._(), new_offset); +abstract class MoqVideoEncoderKind { + RustBuffer lower(); + int allocationSize(); + int write(Uint8List buf); +} + +class FfiConverterMoqVideoEncoderKind { + static MoqVideoEncoderKind lift(RustBuffer buffer) { + return FfiConverterMoqVideoEncoderKind.read(buffer.asUint8List()).value; } - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); + static LiftRetVal read(Uint8List buf) { + final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); + final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); + switch (index) { + case 1: + final lifted = AutoMoqVideoEncoderKind.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 2: + final lifted = HardwareMoqVideoEncoderKind.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 3: + final lifted = SoftwareMoqVideoEncoderKind.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + case 4: + final lifted = NamedMoqVideoEncoderKind.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + default: + throw UniffiInternalError( + UniffiInternalError.unexpectedEnumCase, + "Unable to determine enum variant", + ); + } } - @override - int allocationSize() { - return 4; + static RustBuffer lower(MoqVideoEncoderKind value) { + return value.lower(); } - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 22); - int new_offset = buf.offsetInBytes + 4; - return new_offset; + static int allocationSize(MoqVideoEncoderKind value) { + return value.allocationSize(); + } + + static int write(MoqVideoEncoderKind value, Uint8List buf) { + return value.write(buf) - buf.offsetInBytes; } } -class NotFoundMoqException extends MoqException { - NotFoundMoqException(); - NotFoundMoqException._(); - static LiftRetVal read(Uint8List buf) { +class AutoMoqVideoEncoderKind extends MoqVideoEncoderKind { + AutoMoqVideoEncoderKind(); + AutoMoqVideoEncoderKind._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(NotFoundMoqException._(), new_offset); + return LiftRetVal(AutoMoqVideoEncoderKind._(), new_offset); } @override @@ -4022,18 +6484,18 @@ class NotFoundMoqException extends MoqException { @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 23); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); int new_offset = buf.offsetInBytes + 4; return new_offset; } } -class UnsupportedMoqException extends MoqException { - UnsupportedMoqException(); - UnsupportedMoqException._(); - static LiftRetVal read(Uint8List buf) { +class HardwareMoqVideoEncoderKind extends MoqVideoEncoderKind { + HardwareMoqVideoEncoderKind(); + HardwareMoqVideoEncoderKind._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(UnsupportedMoqException._(), new_offset); + return LiftRetVal(HardwareMoqVideoEncoderKind._(), new_offset); } @override @@ -4050,18 +6512,18 @@ class UnsupportedMoqException extends MoqException { @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 24); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 2); int new_offset = buf.offsetInBytes + 4; return new_offset; } } -class AlreadyCommittedMoqException extends MoqException { - AlreadyCommittedMoqException(); - AlreadyCommittedMoqException._(); - static LiftRetVal read(Uint8List buf) { +class SoftwareMoqVideoEncoderKind extends MoqVideoEncoderKind { + SoftwareMoqVideoEncoderKind(); + SoftwareMoqVideoEncoderKind._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(AlreadyCommittedMoqException._(), new_offset); + return LiftRetVal(SoftwareMoqVideoEncoderKind._(), new_offset); } @override @@ -4078,24 +6540,24 @@ class AlreadyCommittedMoqException extends MoqException { @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 25); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 3); int new_offset = buf.offsetInBytes + 4; return new_offset; } } -class InvalidRouteMoqException extends MoqException { - final String reason; - InvalidRouteMoqException(String this.reason); - InvalidRouteMoqException._(String this.reason); - static LiftRetVal read(Uint8List buf) { +class NamedMoqVideoEncoderKind extends MoqVideoEncoderKind { + final String name; + NamedMoqVideoEncoderKind(String this.name); + NamedMoqVideoEncoderKind._(String this.name); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final reason_lifted = FfiConverterString.read( + final name_lifted = FfiConverterString.read( Uint8List.view(buf.buffer, new_offset), ); - final reason = reason_lifted.value; - new_offset += reason_lifted.bytesRead; - return LiftRetVal(InvalidRouteMoqException._(reason), new_offset); + final name = name_lifted.value; + new_offset += name_lifted.bytesRead; + return LiftRetVal(NamedMoqVideoEncoderKind._(name), new_offset); } @override @@ -4107,71 +6569,75 @@ class InvalidRouteMoqException extends MoqException { @override int allocationSize() { - return FfiConverterString.allocationSize(reason) + 4; + return FfiConverterString.allocationSize(name) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 26); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 4); int new_offset = buf.offsetInBytes + 4; new_offset += FfiConverterString.write( - reason, + name, Uint8List.view(buf.buffer, new_offset), ); return new_offset; } } -class InvalidPatternMoqException extends MoqException { - final String reason; - InvalidPatternMoqException(String this.reason); - InvalidPatternMoqException._(String this.reason); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final reason_lifted = FfiConverterString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final reason = reason_lifted.value; - new_offset += reason_lifted.bytesRead; - return LiftRetVal(InvalidPatternMoqException._(reason), new_offset); +abstract class MoqVideoGop { + RustBuffer lower(); + int allocationSize(); + int write(Uint8List buf); +} + +class FfiConverterMoqVideoGop { + static MoqVideoGop lift(RustBuffer buffer) { + return FfiConverterMoqVideoGop.read(buffer.asUint8List()).value; } - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); + static LiftRetVal read(Uint8List buf) { + final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); + final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); + switch (index) { + case 1: + final lifted = KeyframeMoqVideoGop.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + default: + throw UniffiInternalError( + UniffiInternalError.unexpectedEnumCase, + "Unable to determine enum variant", + ); + } } - @override - int allocationSize() { - return FfiConverterString.allocationSize(reason) + 4; + static RustBuffer lower(MoqVideoGop value) { + return value.lower(); } - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 27); - int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - reason, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset; + static int allocationSize(MoqVideoGop value) { + return value.allocationSize(); + } + + static int write(MoqVideoGop value, Uint8List buf) { + return value.write(buf) - buf.offsetInBytes; } } -class InvalidEpochMoqException extends MoqException { - final String reason; - InvalidEpochMoqException(String this.reason); - InvalidEpochMoqException._(String this.reason); - static LiftRetVal read(Uint8List buf) { +class KeyframeMoqVideoGop extends MoqVideoGop { + final int interval; + KeyframeMoqVideoGop(int this.interval); + KeyframeMoqVideoGop._(int this.interval); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final reason_lifted = FfiConverterString.read( + final interval_lifted = FfiConverterUInt32.read( Uint8List.view(buf.buffer, new_offset), ); - final reason = reason_lifted.value; - new_offset += reason_lifted.bytesRead; - return LiftRetVal(InvalidEpochMoqException._(reason), new_offset); + final interval = interval_lifted.value; + new_offset += interval_lifted.bytesRead; + return LiftRetVal(KeyframeMoqVideoGop._(interval), new_offset); } @override @@ -4183,109 +6649,111 @@ class InvalidEpochMoqException extends MoqException { @override int allocationSize() { - return FfiConverterString.allocationSize(reason) + 4; + return FfiConverterUInt32.allocationSize(interval) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 28); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - reason, + new_offset += FfiConverterUInt32.write( + interval, Uint8List.view(buf.buffer, new_offset), ); return new_offset; } } -class UnresolvableBroadcastMoqException extends MoqException { - final String reason; - UnresolvableBroadcastMoqException(String this.reason); - UnresolvableBroadcastMoqException._(String this.reason); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final reason_lifted = FfiConverterString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final reason = reason_lifted.value; - new_offset += reason_lifted.bytesRead; - return LiftRetVal(UnresolvableBroadcastMoqException._(reason), new_offset); +enum MoqVideoPixelFormat { i420, rgba } + +class FfiConverterMoqVideoPixelFormat { + static LiftRetVal read(Uint8List buf) { + final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); + switch (index) { + case 1: + return LiftRetVal(MoqVideoPixelFormat.i420, 4); + case 2: + return LiftRetVal(MoqVideoPixelFormat.rgba, 4); + default: + throw UniffiInternalError( + UniffiInternalError.unexpectedEnumCase, + "Unable to determine enum variant", + ); + } } - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); + static MoqVideoPixelFormat lift(RustBuffer buffer) { + return FfiConverterMoqVideoPixelFormat.read(buffer.asUint8List()).value; } - @override - int allocationSize() { - return FfiConverterString.allocationSize(reason) + 4; + static RustBuffer lower(MoqVideoPixelFormat input) { + return toRustBuffer(createUint8ListFromInt(input.index + 1)); } - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 29); - int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - reason, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset; + static int allocationSize(MoqVideoPixelFormat _value) { + return 4; + } + + static int write(MoqVideoPixelFormat value, Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, value.index + 1); + return 4; } } -class LogMoqException extends MoqException { - final String reason; - LogMoqException(String this.reason); - LogMoqException._(String this.reason); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final reason_lifted = FfiConverterString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final reason = reason_lifted.value; - new_offset += reason_lifted.bytesRead; - return LiftRetVal(LogMoqException._(reason), new_offset); +abstract class MoqVideoSurface { + RustBuffer lower(); + int allocationSize(); + int write(Uint8List buf); +} + +class FfiConverterMoqVideoSurface { + static MoqVideoSurface lift(RustBuffer buffer) { + return FfiConverterMoqVideoSurface.read(buffer.asUint8List()).value; + } + + static LiftRetVal read(Uint8List buf) { + final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); + final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); + switch (index) { + case 1: + final lifted = PixelBufferMoqVideoSurface.read(subview); + return LiftRetVal( + lifted.value, + lifted.bytesRead - subview.offsetInBytes + 4, + ); + default: + throw UniffiInternalError( + UniffiInternalError.unexpectedEnumCase, + "Unable to determine enum variant", + ); + } } - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); + static RustBuffer lower(MoqVideoSurface value) { + return value.lower(); } - @override - int allocationSize() { - return FfiConverterString.allocationSize(reason) + 4; + static int allocationSize(MoqVideoSurface value) { + return value.allocationSize(); } - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 30); - int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - reason, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset; + static int write(MoqVideoSurface value, Uint8List buf) { + return value.write(buf) - buf.offsetInBytes; } } -class ConfigMoqException extends MoqException { - final String reason; - ConfigMoqException(String this.reason); - ConfigMoqException._(String this.reason); - static LiftRetVal read(Uint8List buf) { +class PixelBufferMoqVideoSurface extends MoqVideoSurface { + final int pointer; + PixelBufferMoqVideoSurface(int this.pointer); + PixelBufferMoqVideoSurface._(int this.pointer); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final reason_lifted = FfiConverterString.read( + final pointer_lifted = FfiConverterUInt64.read( Uint8List.view(buf.buffer, new_offset), ); - final reason = reason_lifted.value; - new_offset += reason_lifted.bytesRead; - return LiftRetVal(ConfigMoqException._(reason), new_offset); + final pointer = pointer_lifted.value; + new_offset += pointer_lifted.bytesRead; + return LiftRetVal(PixelBufferMoqVideoSurface._(pointer), new_offset); } @override @@ -4297,1035 +6765,1140 @@ class ConfigMoqException extends MoqException { @override int allocationSize() { - return FfiConverterString.allocationSize(reason) + 4; + return FfiConverterUInt64.allocationSize(pointer) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 31); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - reason, + new_offset += FfiConverterUInt64.write( + pointer, Uint8List.view(buf.buffer, new_offset), ); return new_offset; } } -class MoqExceptionErrorHandler extends UniffiRustCallStatusErrorHandler { - @override - Exception lift(RustBuffer errorBuf) { - return FfiConverterMoqException.lift(errorBuf); - } -} +abstract class MoqAudioCodecInterface {} -final MoqExceptionErrorHandler moqExceptionErrorHandler = - MoqExceptionErrorHandler(); +final _MoqAudioCodecFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_moq_ffi_fn_free_moqaudiocodec(ptr, status)); +}); -enum MoqErrorScope { session, stream } +class MoqAudioCodec implements MoqAudioCodecInterface { + late final Pointer _ptr; + bool _isDisposed = false; + MoqAudioCodec._(this._ptr) { + _MoqAudioCodecFinalizer.attach(this, _ptr, detach: this); + } + MoqAudioCodec.aac() + : _ptr = rustCall( + (status) => uniffi_moq_ffi_fn_constructor_moqaudiocodec_aac(status), + null, + ) { + _MoqAudioCodecFinalizer.attach(this, _ptr, detach: this); + } + MoqAudioCodec.opus() + : _ptr = rustCall( + (status) => uniffi_moq_ffi_fn_constructor_moqaudiocodec_opus(status), + null, + ) { + _MoqAudioCodecFinalizer.attach(this, _ptr, detach: this); + } + factory MoqAudioCodec.lift(Pointer ptr) { + return MoqAudioCodec._(ptr); + } + Pointer uniffiClonePointer() { + if (_isDisposed) { + throw StateError("Object has already been disposed"); + } + return rustCall( + (status) => uniffi_moq_ffi_fn_clone_moqaudiocodec(_ptr, status), + ); + } -class FfiConverterMoqErrorScope { - static LiftRetVal read(Uint8List buf) { - final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); - switch (index) { - case 1: - return LiftRetVal(MoqErrorScope.session, 4); - case 2: - return LiftRetVal(MoqErrorScope.stream, 4); - default: - throw UniffiInternalError( - UniffiInternalError.unexpectedEnumCase, - "Unable to determine enum variant", - ); + void dispose() { + if (_isDisposed) { + return; } + _isDisposed = true; + _MoqAudioCodecFinalizer.detach(this); + rustCall((status) => uniffi_moq_ffi_fn_free_moqaudiocodec(_ptr, status)); } +} - static MoqErrorScope lift(RustBuffer buffer) { - return FfiConverterMoqErrorScope.read(buffer.asUint8List()).value; +class FfiConverterMoqAudioCodec { + static MoqAudioCodec lift(Pointer ptr) { + return MoqAudioCodec.lift(ptr); } - static RustBuffer lower(MoqErrorScope input) { - return toRustBuffer(createUint8ListFromInt(input.index + 1)); + static Pointer lower(MoqAudioCodec value) { + return value.uniffiClonePointer(); } - static int allocationSize(MoqErrorScope _value) { - return 4; + static int allocationSize(MoqAudioCodec value) { + return 8; } - static int write(MoqErrorScope value, Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, value.index + 1); - return 4; + static LiftRetVal read(Uint8List buf) { + final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); + final pointer = Pointer.fromAddress(handle); + return LiftRetVal(MoqAudioCodec.lift(pointer), 8); + } + + static int write(MoqAudioCodec value, Uint8List buf) { + final handle = lower(value); + buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); + return 8; } } -enum MoqProtocolKind { - cancel, - internal, - unauthorized, - protocolViolation, - keyValueFormatting, - goawayTimeout, - timeout, - version, - deliveryTimeout, - sessionClosed, - goingAway, - tooFarBehind, - malformedTrack, - notFound, - unroutable, - old, - evicted, - wrongSize, - frameTooLarge, - timestampMismatch, - app, - unknown, - tooManyRequests, - expired, +abstract class MoqAudioConsumerInterface { + void cancel(); + Future next(); } -class FfiConverterMoqProtocolKind { - static LiftRetVal read(Uint8List buf) { - final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); - switch (index) { - case 1: - return LiftRetVal(MoqProtocolKind.cancel, 4); - case 2: - return LiftRetVal(MoqProtocolKind.internal, 4); - case 3: - return LiftRetVal(MoqProtocolKind.unauthorized, 4); - case 4: - return LiftRetVal(MoqProtocolKind.protocolViolation, 4); - case 5: - return LiftRetVal(MoqProtocolKind.keyValueFormatting, 4); - case 6: - return LiftRetVal(MoqProtocolKind.goawayTimeout, 4); - case 7: - return LiftRetVal(MoqProtocolKind.timeout, 4); - case 8: - return LiftRetVal(MoqProtocolKind.version, 4); - case 9: - return LiftRetVal(MoqProtocolKind.deliveryTimeout, 4); - case 10: - return LiftRetVal(MoqProtocolKind.sessionClosed, 4); - case 11: - return LiftRetVal(MoqProtocolKind.goingAway, 4); - case 12: - return LiftRetVal(MoqProtocolKind.tooFarBehind, 4); - case 13: - return LiftRetVal(MoqProtocolKind.malformedTrack, 4); - case 14: - return LiftRetVal(MoqProtocolKind.notFound, 4); - case 15: - return LiftRetVal(MoqProtocolKind.unroutable, 4); - case 16: - return LiftRetVal(MoqProtocolKind.old, 4); - case 17: - return LiftRetVal(MoqProtocolKind.evicted, 4); - case 18: - return LiftRetVal(MoqProtocolKind.wrongSize, 4); - case 19: - return LiftRetVal(MoqProtocolKind.frameTooLarge, 4); - case 20: - return LiftRetVal(MoqProtocolKind.timestampMismatch, 4); - case 21: - return LiftRetVal(MoqProtocolKind.app, 4); - case 22: - return LiftRetVal(MoqProtocolKind.unknown, 4); - case 23: - return LiftRetVal(MoqProtocolKind.tooManyRequests, 4); - case 24: - return LiftRetVal(MoqProtocolKind.expired, 4); - default: - throw UniffiInternalError( - UniffiInternalError.unexpectedEnumCase, - "Unable to determine enum variant", - ); - } - } +final _MoqAudioConsumerFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_moq_ffi_fn_free_moqaudioconsumer(ptr, status)); +}); - static MoqProtocolKind lift(RustBuffer buffer) { - return FfiConverterMoqProtocolKind.read(buffer.asUint8List()).value; +class MoqAudioConsumer implements MoqAudioConsumerInterface { + late final Pointer _ptr; + bool _isDisposed = false; + MoqAudioConsumer._(this._ptr) { + _MoqAudioConsumerFinalizer.attach(this, _ptr, detach: this); } - - static RustBuffer lower(MoqProtocolKind input) { - return toRustBuffer(createUint8ListFromInt(input.index + 1)); + static Future subscribe({ + required MoqBroadcastConsumer broadcast, + required String id, + required MoqAudio catalogAudio, + required MoqAudioDecoderOutput output, + }) { + return uniffiRustCallAsync( + () => uniffi_moq_ffi_fn_constructor_moqaudioconsumer_subscribe( + FfiConverterMoqBroadcastConsumer.lower(broadcast), + FfiConverterString.lower(id), + FfiConverterMoqAudio.lower(catalogAudio), + FfiConverterMoqAudioDecoderOutput.lower(output), + ), + ffi_moq_ffi_rust_future_poll_u64, + ffi_moq_ffi_rust_future_complete_u64, + ffi_moq_ffi_rust_future_free_u64, + (int handle) => MoqAudioConsumer._(Pointer.fromAddress(handle)), + moqExceptionErrorHandler, + ); } - static int allocationSize(MoqProtocolKind _value) { - return 4; + factory MoqAudioConsumer.lift(Pointer ptr) { + return MoqAudioConsumer._(ptr); + } + Pointer uniffiClonePointer() { + if (_isDisposed) { + throw StateError("Object has already been disposed"); + } + return rustCall( + (status) => uniffi_moq_ffi_fn_clone_moqaudioconsumer(_ptr, status), + ); } - static int write(MoqProtocolKind value, Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, value.index + 1); - return 4; + void dispose() { + if (_isDisposed) { + return; + } + _isDisposed = true; + _MoqAudioConsumerFinalizer.detach(this); + rustCall((status) => uniffi_moq_ffi_fn_free_moqaudioconsumer(_ptr, status)); } -} -enum MoqAudioFormat { aac, opus, flac, mp3 } + void cancel() { + return rustCall((status) { + uniffi_moq_ffi_fn_method_moqaudioconsumer_cancel( + uniffiClonePointer(), + status, + ); + }, null); + } -class FfiConverterMoqAudioFormat { - static LiftRetVal read(Uint8List buf) { - final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); - switch (index) { - case 1: - return LiftRetVal(MoqAudioFormat.aac, 4); - case 2: - return LiftRetVal(MoqAudioFormat.opus, 4); - case 3: - return LiftRetVal(MoqAudioFormat.flac, 4); - case 4: - return LiftRetVal(MoqAudioFormat.mp3, 4); - default: - throw UniffiInternalError( - UniffiInternalError.unexpectedEnumCase, - "Unable to determine enum variant", - ); - } + Future next() { + return uniffiRustCallAsync( + () => + uniffi_moq_ffi_fn_method_moqaudioconsumer_next(uniffiClonePointer()), + ffi_moq_ffi_rust_future_poll_rust_buffer, + ffi_moq_ffi_rust_future_complete_rust_buffer, + ffi_moq_ffi_rust_future_free_rust_buffer, + FfiConverterOptionalMoqAudioFrame.lift, + moqExceptionErrorHandler, + ); + } +} + +class FfiConverterMoqAudioConsumer { + static MoqAudioConsumer lift(Pointer ptr) { + return MoqAudioConsumer.lift(ptr); } - static MoqAudioFormat lift(RustBuffer buffer) { - return FfiConverterMoqAudioFormat.read(buffer.asUint8List()).value; + static Pointer lower(MoqAudioConsumer value) { + return value.uniffiClonePointer(); } - static RustBuffer lower(MoqAudioFormat input) { - return toRustBuffer(createUint8ListFromInt(input.index + 1)); + static int allocationSize(MoqAudioConsumer value) { + return 8; } - static int allocationSize(MoqAudioFormat _value) { - return 4; + static LiftRetVal read(Uint8List buf) { + final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); + final pointer = Pointer.fromAddress(handle); + return LiftRetVal(MoqAudioConsumer.lift(pointer), 8); } - static int write(MoqAudioFormat value, Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, value.index + 1); - return 4; + static int write(MoqAudioConsumer value, Uint8List buf) { + final handle = lower(value); + buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); + return 8; } } -abstract class MoqContainer { - RustBuffer lower(); - int allocationSize(); - int write(Uint8List buf); +abstract class MoqAudioEncoderInterface { + MoqAudioPacket encode({required List pcm}); + MoqAudioEncoderFinish finish({required List pcm}); + int frameSize(); + void setBitrate({required int bitrate}); + MoqAudioInit trackInit(); } -class FfiConverterMoqContainer { - static MoqContainer lift(RustBuffer buffer) { - return FfiConverterMoqContainer.read(buffer.asUint8List()).value; - } +final _MoqAudioEncoderFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_moq_ffi_fn_free_moqaudioencoder(ptr, status)); +}); - static LiftRetVal read(Uint8List buf) { - final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); - final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); - switch (index) { - case 1: - final lifted = LegacyMoqContainer.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 2: - final lifted = CmafMoqContainer.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 3: - final lifted = LocMoqContainer.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - default: - throw UniffiInternalError( - UniffiInternalError.unexpectedEnumCase, - "Unable to determine enum variant", - ); +class MoqAudioEncoder implements MoqAudioEncoderInterface { + late final Pointer _ptr; + bool _isDisposed = false; + MoqAudioEncoder._(this._ptr) { + _MoqAudioEncoderFinalizer.attach(this, _ptr, detach: this); + } + MoqAudioEncoder({required MoqAudioEncoderOutput output}) + : _ptr = rustCall( + (status) => uniffi_moq_ffi_fn_constructor_moqaudioencoder_new( + FfiConverterMoqAudioEncoderOutput.lower(output), + status, + ), + moqExceptionErrorHandler, + ) { + _MoqAudioEncoderFinalizer.attach(this, _ptr, detach: this); + } + factory MoqAudioEncoder.lift(Pointer ptr) { + return MoqAudioEncoder._(ptr); + } + Pointer uniffiClonePointer() { + if (_isDisposed) { + throw StateError("Object has already been disposed"); } + return rustCall( + (status) => uniffi_moq_ffi_fn_clone_moqaudioencoder(_ptr, status), + ); } - static RustBuffer lower(MoqContainer value) { - return value.lower(); + void dispose() { + if (_isDisposed) { + return; + } + _isDisposed = true; + _MoqAudioEncoderFinalizer.detach(this); + rustCall((status) => uniffi_moq_ffi_fn_free_moqaudioencoder(_ptr, status)); } - static int allocationSize(MoqContainer value) { - return value.allocationSize(); + MoqAudioPacket encode({required List pcm}) { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqaudioencoder_encode( + uniffiClonePointer(), + FfiConverterSequenceDouble32.lower(pcm), + status, + ), + FfiConverterMoqAudioPacket.lift, + moqExceptionErrorHandler, + ); } - static int write(MoqContainer value, Uint8List buf) { - return value.write(buf) - buf.offsetInBytes; + MoqAudioEncoderFinish finish({required List pcm}) { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqaudioencoder_finish( + uniffiClonePointer(), + FfiConverterSequenceDouble32.lower(pcm), + status, + ), + FfiConverterMoqAudioEncoderFinish.lift, + moqExceptionErrorHandler, + ); } -} -class LegacyMoqContainer extends MoqContainer { - LegacyMoqContainer(); - LegacyMoqContainer._(); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - return LiftRetVal(LegacyMoqContainer._(), new_offset); + int frameSize() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqaudioencoder_frame_size( + uniffiClonePointer(), + status, + ), + FfiConverterUInt64.lift, + moqExceptionErrorHandler, + ); } - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); + void setBitrate({required int bitrate}) { + return rustCall((status) { + uniffi_moq_ffi_fn_method_moqaudioencoder_set_bitrate( + uniffiClonePointer(), + FfiConverterUInt64.lower(bitrate), + status, + ); + }, moqExceptionErrorHandler); } - @override - int allocationSize() { - return 4; + MoqAudioInit trackInit() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqaudioencoder_track_init( + uniffiClonePointer(), + status, + ), + FfiConverterMoqAudioInit.lift, + moqExceptionErrorHandler, + ); } +} - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); - int new_offset = buf.offsetInBytes + 4; - return new_offset; +class FfiConverterMoqAudioEncoder { + static MoqAudioEncoder lift(Pointer ptr) { + return MoqAudioEncoder.lift(ptr); } -} -class CmafMoqContainer extends MoqContainer { - final Uint8List init; - CmafMoqContainer(Uint8List this.init); - CmafMoqContainer._(Uint8List this.init); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final init_lifted = FfiConverterUint8List.read( - Uint8List.view(buf.buffer, new_offset), - ); - final init = init_lifted.value; - new_offset += init_lifted.bytesRead; - return LiftRetVal(CmafMoqContainer._(init), new_offset); + static Pointer lower(MoqAudioEncoder value) { + return value.uniffiClonePointer(); } - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); + static int allocationSize(MoqAudioEncoder value) { + return 8; } - @override - int allocationSize() { - return FfiConverterUint8List.allocationSize(init) + 4; + static LiftRetVal read(Uint8List buf) { + final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); + final pointer = Pointer.fromAddress(handle); + return LiftRetVal(MoqAudioEncoder.lift(pointer), 8); } - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 2); - int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterUint8List.write( - init, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset; + static int write(MoqAudioEncoder value, Uint8List buf) { + final handle = lower(value); + buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); + return 8; } } -class LocMoqContainer extends MoqContainer { - LocMoqContainer(); - LocMoqContainer._(); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - return LiftRetVal(LocMoqContainer._(), new_offset); - } +abstract class MoqAudioProducerInterface { + MoqTrackDemand demand(); + void finish(); + void reanchor(); + MoqReservation? reservation(); + void write({required MoqAudioFrame frame}); +} - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); - } +final _MoqAudioProducerFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_moq_ffi_fn_free_moqaudioproducer(ptr, status)); +}); - @override - int allocationSize() { - return 4; +class MoqAudioProducer implements MoqAudioProducerInterface { + late final Pointer _ptr; + bool _isDisposed = false; + MoqAudioProducer._(this._ptr) { + _MoqAudioProducerFinalizer.attach(this, _ptr, detach: this); + } + MoqAudioProducer({ + required MoqMediaCatalogProducer catalog, + required MoqAudioEncoderInput input, + required MoqAudioEncoderOutput output, + MoqBandwidth? bandwidth = null, + }) : _ptr = rustCall( + (status) => uniffi_moq_ffi_fn_constructor_moqaudioproducer_new( + FfiConverterMoqMediaCatalogProducer.lower(catalog), + FfiConverterMoqAudioEncoderInput.lower(input), + FfiConverterMoqAudioEncoderOutput.lower(output), + FfiConverterOptionalMoqBandwidth.lower(bandwidth), + status, + ), + moqExceptionErrorHandler, + ) { + _MoqAudioProducerFinalizer.attach(this, _ptr, detach: this); } - - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 3); - int new_offset = buf.offsetInBytes + 4; - return new_offset; + factory MoqAudioProducer.lift(Pointer ptr) { + return MoqAudioProducer._(ptr); + } + Pointer uniffiClonePointer() { + if (_isDisposed) { + throw StateError("Object has already been disposed"); + } + return rustCall( + (status) => uniffi_moq_ffi_fn_clone_moqaudioproducer(_ptr, status), + ); } -} - -enum MoqContainerFormat { fmp4, mkv, ts, flv } -class FfiConverterMoqContainerFormat { - static LiftRetVal read(Uint8List buf) { - final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); - switch (index) { - case 1: - return LiftRetVal(MoqContainerFormat.fmp4, 4); - case 2: - return LiftRetVal(MoqContainerFormat.mkv, 4); - case 3: - return LiftRetVal(MoqContainerFormat.ts, 4); - case 4: - return LiftRetVal(MoqContainerFormat.flv, 4); - default: - throw UniffiInternalError( - UniffiInternalError.unexpectedEnumCase, - "Unable to determine enum variant", - ); + void dispose() { + if (_isDisposed) { + return; } + _isDisposed = true; + _MoqAudioProducerFinalizer.detach(this); + rustCall((status) => uniffi_moq_ffi_fn_free_moqaudioproducer(_ptr, status)); } - static MoqContainerFormat lift(RustBuffer buffer) { - return FfiConverterMoqContainerFormat.read(buffer.asUint8List()).value; + MoqTrackDemand demand() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqaudioproducer_demand( + uniffiClonePointer(), + status, + ), + FfiConverterMoqTrackDemand.lift, + moqExceptionErrorHandler, + ); } - static RustBuffer lower(MoqContainerFormat input) { - return toRustBuffer(createUint8ListFromInt(input.index + 1)); + void finish() { + return rustCall((status) { + uniffi_moq_ffi_fn_method_moqaudioproducer_finish( + uniffiClonePointer(), + status, + ); + }, moqExceptionErrorHandler); + } + + void reanchor() { + return rustCall((status) { + uniffi_moq_ffi_fn_method_moqaudioproducer_reanchor( + uniffiClonePointer(), + status, + ); + }, moqExceptionErrorHandler); } - static int allocationSize(MoqContainerFormat _value) { - return 4; + MoqReservation? reservation() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqaudioproducer_reservation( + uniffiClonePointer(), + status, + ), + FfiConverterOptionalMoqReservation.lift, + null, + ); } - static int write(MoqContainerFormat value, Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, value.index + 1); - return 4; + void write({required MoqAudioFrame frame}) { + return rustCall((status) { + uniffi_moq_ffi_fn_method_moqaudioproducer_write( + uniffiClonePointer(), + FfiConverterMoqAudioFrame.lower(frame), + status, + ); + }, moqExceptionErrorHandler); } } -abstract class MoqMediaTarget { - RustBuffer lower(); - int allocationSize(); - int write(Uint8List buf); -} - -class FfiConverterMoqMediaTarget { - static MoqMediaTarget lift(RustBuffer buffer) { - return FfiConverterMoqMediaTarget.read(buffer.asUint8List()).value; +class FfiConverterMoqAudioProducer { + static MoqAudioProducer lift(Pointer ptr) { + return MoqAudioProducer.lift(ptr); } - static LiftRetVal read(Uint8List buf) { - final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); - final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); - switch (index) { - case 1: - final lifted = NamedMoqMediaTarget.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 2: - final lifted = RequestedMoqMediaTarget.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - default: - throw UniffiInternalError( - UniffiInternalError.unexpectedEnumCase, - "Unable to determine enum variant", - ); - } + static Pointer lower(MoqAudioProducer value) { + return value.uniffiClonePointer(); } - static RustBuffer lower(MoqMediaTarget value) { - return value.lower(); + static int allocationSize(MoqAudioProducer value) { + return 8; } - static int allocationSize(MoqMediaTarget value) { - return value.allocationSize(); + static LiftRetVal read(Uint8List buf) { + final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); + final pointer = Pointer.fromAddress(handle); + return LiftRetVal(MoqAudioProducer.lift(pointer), 8); } - static int write(MoqMediaTarget value, Uint8List buf) { - return value.write(buf) - buf.offsetInBytes; + static int write(MoqAudioProducer value, Uint8List buf) { + final handle = lower(value); + buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); + return 8; } } -class NamedMoqMediaTarget extends MoqMediaTarget { - final String? name; - NamedMoqMediaTarget(String? this.name); - NamedMoqMediaTarget._(String? this.name); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final name_lifted = FfiConverterOptionalString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final name = name_lifted.value; - new_offset += name_lifted.bytesRead; - return LiftRetVal(NamedMoqMediaTarget._(name), new_offset); - } +abstract class MoqBandwidthInterface { + MoqReservation reserve({required MoqTrackDemand demand, required int maxBps}); +} - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); +final _MoqBandwidthFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_moq_ffi_fn_free_moqbandwidth(ptr, status)); +}); + +class MoqBandwidth implements MoqBandwidthInterface { + late final Pointer _ptr; + bool _isDisposed = false; + MoqBandwidth._(this._ptr) { + _MoqBandwidthFinalizer.attach(this, _ptr, detach: this); + } + factory MoqBandwidth.lift(Pointer ptr) { + return MoqBandwidth._(ptr); + } + Pointer uniffiClonePointer() { + if (_isDisposed) { + throw StateError("Object has already been disposed"); + } + return rustCall( + (status) => uniffi_moq_ffi_fn_clone_moqbandwidth(_ptr, status), + ); } - @override - int allocationSize() { - return FfiConverterOptionalString.allocationSize(name) + 4; + void dispose() { + if (_isDisposed) { + return; + } + _isDisposed = true; + _MoqBandwidthFinalizer.detach(this); + rustCall((status) => uniffi_moq_ffi_fn_free_moqbandwidth(_ptr, status)); } - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); - int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterOptionalString.write( - name, - Uint8List.view(buf.buffer, new_offset), + MoqReservation reserve({ + required MoqTrackDemand demand, + required int maxBps, + }) { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqbandwidth_reserve( + uniffiClonePointer(), + FfiConverterMoqTrackDemand.lower(demand), + FfiConverterUInt64.lower(maxBps), + status, + ), + FfiConverterMoqReservation.lift, + null, ); - return new_offset; } } -class RequestedMoqMediaTarget extends MoqMediaTarget { - final MoqTrackRequest request; - RequestedMoqMediaTarget(MoqTrackRequest this.request); - RequestedMoqMediaTarget._(MoqTrackRequest this.request); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final request_lifted = FfiConverterMoqTrackRequest.read( - Uint8List.view(buf.buffer, new_offset), - ); - final request = request_lifted.value; - new_offset += request_lifted.bytesRead; - return LiftRetVal(RequestedMoqMediaTarget._(request), new_offset); +class FfiConverterMoqBandwidth { + static MoqBandwidth lift(Pointer ptr) { + return MoqBandwidth.lift(ptr); } - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); + static Pointer lower(MoqBandwidth value) { + return value.uniffiClonePointer(); } - @override - int allocationSize() { - return FfiConverterMoqTrackRequest.allocationSize(request) + 4; + static int allocationSize(MoqBandwidth value) { + return 8; } - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 2); - int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterMoqTrackRequest.write( - request, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset; + static LiftRetVal read(Uint8List buf) { + final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); + final pointer = Pointer.fromAddress(handle); + return LiftRetVal(MoqBandwidth.lift(pointer), 8); + } + + static int write(MoqBandwidth value, Uint8List buf) { + final handle = lower(value); + buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); + return 8; } } -abstract class MoqRendition { - RustBuffer lower(); - int allocationSize(); - int write(Uint8List buf); +abstract class MoqReservationInterface { + int? grant(); + void update({required int maxBps}); } -class FfiConverterMoqRendition { - static MoqRendition lift(RustBuffer buffer) { - return FfiConverterMoqRendition.read(buffer.asUint8List()).value; +final _MoqReservationFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_moq_ffi_fn_free_moqreservation(ptr, status)); +}); + +class MoqReservation implements MoqReservationInterface { + late final Pointer _ptr; + bool _isDisposed = false; + MoqReservation._(this._ptr) { + _MoqReservationFinalizer.attach(this, _ptr, detach: this); + } + factory MoqReservation.lift(Pointer ptr) { + return MoqReservation._(ptr); + } + Pointer uniffiClonePointer() { + if (_isDisposed) { + throw StateError("Object has already been disposed"); + } + return rustCall( + (status) => uniffi_moq_ffi_fn_clone_moqreservation(_ptr, status), + ); } - static LiftRetVal read(Uint8List buf) { - final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); - final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); - switch (index) { - case 1: - final lifted = VideoMoqRendition.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 2: - final lifted = AudioMoqRendition.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - default: - throw UniffiInternalError( - UniffiInternalError.unexpectedEnumCase, - "Unable to determine enum variant", - ); + void dispose() { + if (_isDisposed) { + return; } + _isDisposed = true; + _MoqReservationFinalizer.detach(this); + rustCall((status) => uniffi_moq_ffi_fn_free_moqreservation(_ptr, status)); + } + + int? grant() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqreservation_grant( + uniffiClonePointer(), + status, + ), + FfiConverterOptionalUInt64.lift, + null, + ); + } + + void update({required int maxBps}) { + return rustCall((status) { + uniffi_moq_ffi_fn_method_moqreservation_update( + uniffiClonePointer(), + FfiConverterUInt64.lower(maxBps), + status, + ); + }, null); } +} - static RustBuffer lower(MoqRendition value) { - return value.lower(); +class FfiConverterMoqReservation { + static MoqReservation lift(Pointer ptr) { + return MoqReservation.lift(ptr); } - static int allocationSize(MoqRendition value) { - return value.allocationSize(); + static Pointer lower(MoqReservation value) { + return value.uniffiClonePointer(); } - static int write(MoqRendition value, Uint8List buf) { - return value.write(buf) - buf.offsetInBytes; + static int allocationSize(MoqReservation value) { + return 8; + } + + static LiftRetVal read(Uint8List buf) { + final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); + final pointer = Pointer.fromAddress(handle); + return LiftRetVal(MoqReservation.lift(pointer), 8); + } + + static int write(MoqReservation value, Uint8List buf) { + final handle = lower(value); + buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); + return 8; } } -class VideoMoqRendition extends MoqRendition { - final String id; - final MoqVideo config; - VideoMoqRendition({required String this.id, required MoqVideo this.config}); - VideoMoqRendition._(String this.id, MoqVideo this.config); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final id_lifted = FfiConverterString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final id = id_lifted.value; - new_offset += id_lifted.bytesRead; - final config_lifted = FfiConverterMoqVideo.read( - Uint8List.view(buf.buffer, new_offset), +abstract class MoqBroadcastConsumerInterface { + Future fetchGroup({ + required String name, + required int sequence, + required MoqFetchGroupOptions? options, + }); + Future resolve({required String? reference}); + Future subscribeTrack({ + required String name, + required MoqSubscription? subscription, + }); +} + +final _MoqBroadcastConsumerFinalizer = Finalizer>((ptr) { + rustCall( + (status) => uniffi_moq_ffi_fn_free_moqbroadcastconsumer(ptr, status), + ); +}); + +class MoqBroadcastConsumer implements MoqBroadcastConsumerInterface { + late final Pointer _ptr; + bool _isDisposed = false; + MoqBroadcastConsumer._(this._ptr) { + _MoqBroadcastConsumerFinalizer.attach(this, _ptr, detach: this); + } + factory MoqBroadcastConsumer.lift(Pointer ptr) { + return MoqBroadcastConsumer._(ptr); + } + Pointer uniffiClonePointer() { + if (_isDisposed) { + throw StateError("Object has already been disposed"); + } + return rustCall( + (status) => uniffi_moq_ffi_fn_clone_moqbroadcastconsumer(_ptr, status), ); - final config = config_lifted.value; - new_offset += config_lifted.bytesRead; - return LiftRetVal(VideoMoqRendition._(id, config), new_offset); } - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); + void dispose() { + if (_isDisposed) { + return; + } + _isDisposed = true; + _MoqBroadcastConsumerFinalizer.detach(this); + rustCall( + (status) => uniffi_moq_ffi_fn_free_moqbroadcastconsumer(_ptr, status), + ); } - @override - int allocationSize() { - return FfiConverterString.allocationSize(id) + - FfiConverterMoqVideo.allocationSize(config) + - 4; + Future fetchGroup({ + required String name, + required int sequence, + required MoqFetchGroupOptions? options, + }) { + return uniffiRustCallAsync( + () => uniffi_moq_ffi_fn_method_moqbroadcastconsumer_fetch_group( + uniffiClonePointer(), + FfiConverterString.lower(name), + FfiConverterUInt64.lower(sequence), + FfiConverterOptionalMoqFetchGroupOptions.lower(options), + ), + ffi_moq_ffi_rust_future_poll_u64, + ffi_moq_ffi_rust_future_complete_u64, + ffi_moq_ffi_rust_future_free_u64, + (ptr) => + FfiConverterMoqGroupConsumer.lift(Pointer.fromAddress(ptr)), + moqExceptionErrorHandler, + ); } - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); - int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - id, - Uint8List.view(buf.buffer, new_offset), + Future resolve({required String? reference}) { + return uniffiRustCallAsync( + () => uniffi_moq_ffi_fn_method_moqbroadcastconsumer_resolve( + uniffiClonePointer(), + FfiConverterOptionalString.lower(reference), + ), + ffi_moq_ffi_rust_future_poll_u64, + ffi_moq_ffi_rust_future_complete_u64, + ffi_moq_ffi_rust_future_free_u64, + (ptr) => + FfiConverterMoqBroadcastConsumer.lift(Pointer.fromAddress(ptr)), + moqExceptionErrorHandler, ); - new_offset += FfiConverterMoqVideo.write( - config, - Uint8List.view(buf.buffer, new_offset), + } + + Future subscribeTrack({ + required String name, + required MoqSubscription? subscription, + }) { + return uniffiRustCallAsync( + () => uniffi_moq_ffi_fn_method_moqbroadcastconsumer_subscribe_track( + uniffiClonePointer(), + FfiConverterString.lower(name), + FfiConverterOptionalMoqSubscription.lower(subscription), + ), + ffi_moq_ffi_rust_future_poll_u64, + ffi_moq_ffi_rust_future_complete_u64, + ffi_moq_ffi_rust_future_free_u64, + (ptr) => + FfiConverterMoqTrackConsumer.lift(Pointer.fromAddress(ptr)), + moqExceptionErrorHandler, ); - return new_offset; } } -class AudioMoqRendition extends MoqRendition { - final String id; - final MoqAudio config; - AudioMoqRendition({required String this.id, required MoqAudio this.config}); - AudioMoqRendition._(String this.id, MoqAudio this.config); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final id_lifted = FfiConverterString.read( - Uint8List.view(buf.buffer, new_offset), - ); - final id = id_lifted.value; - new_offset += id_lifted.bytesRead; - final config_lifted = FfiConverterMoqAudio.read( - Uint8List.view(buf.buffer, new_offset), - ); - final config = config_lifted.value; - new_offset += config_lifted.bytesRead; - return LiftRetVal(AudioMoqRendition._(id, config), new_offset); +class FfiConverterMoqBroadcastConsumer { + static MoqBroadcastConsumer lift(Pointer ptr) { + return MoqBroadcastConsumer.lift(ptr); } - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); + static Pointer lower(MoqBroadcastConsumer value) { + return value.uniffiClonePointer(); } - @override - int allocationSize() { - return FfiConverterString.allocationSize(id) + - FfiConverterMoqAudio.allocationSize(config) + - 4; + static int allocationSize(MoqBroadcastConsumer value) { + return 8; } - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 2); - int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - id, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterMoqAudio.write( - config, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset; + static LiftRetVal read(Uint8List buf) { + final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); + final pointer = Pointer.fromAddress(handle); + return LiftRetVal(MoqBroadcastConsumer.lift(pointer), 8); + } + + static int write(MoqBroadcastConsumer value, Uint8List buf) { + final handle = lower(value); + buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); + return 8; } } -enum MoqVideoFormat { avc1, avc3, hvc1, hev1, av01, vp8, vp9 } +abstract class MoqGroupConsumerInterface { + void cancel(); + Future readFrame(); + int sequence(); +} -class FfiConverterMoqVideoFormat { - static LiftRetVal read(Uint8List buf) { - final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); - switch (index) { - case 1: - return LiftRetVal(MoqVideoFormat.avc1, 4); - case 2: - return LiftRetVal(MoqVideoFormat.avc3, 4); - case 3: - return LiftRetVal(MoqVideoFormat.hvc1, 4); - case 4: - return LiftRetVal(MoqVideoFormat.hev1, 4); - case 5: - return LiftRetVal(MoqVideoFormat.av01, 4); - case 6: - return LiftRetVal(MoqVideoFormat.vp8, 4); - case 7: - return LiftRetVal(MoqVideoFormat.vp9, 4); - default: - throw UniffiInternalError( - UniffiInternalError.unexpectedEnumCase, - "Unable to determine enum variant", - ); +final _MoqGroupConsumerFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_moq_ffi_fn_free_moqgroupconsumer(ptr, status)); +}); + +class MoqGroupConsumer implements MoqGroupConsumerInterface { + late final Pointer _ptr; + bool _isDisposed = false; + MoqGroupConsumer._(this._ptr) { + _MoqGroupConsumerFinalizer.attach(this, _ptr, detach: this); + } + factory MoqGroupConsumer.lift(Pointer ptr) { + return MoqGroupConsumer._(ptr); + } + Pointer uniffiClonePointer() { + if (_isDisposed) { + throw StateError("Object has already been disposed"); } + return rustCall( + (status) => uniffi_moq_ffi_fn_clone_moqgroupconsumer(_ptr, status), + ); } - static MoqVideoFormat lift(RustBuffer buffer) { - return FfiConverterMoqVideoFormat.read(buffer.asUint8List()).value; + void dispose() { + if (_isDisposed) { + return; + } + _isDisposed = true; + _MoqGroupConsumerFinalizer.detach(this); + rustCall((status) => uniffi_moq_ffi_fn_free_moqgroupconsumer(_ptr, status)); } - static RustBuffer lower(MoqVideoFormat input) { - return toRustBuffer(createUint8ListFromInt(input.index + 1)); + void cancel() { + return rustCall((status) { + uniffi_moq_ffi_fn_method_moqgroupconsumer_cancel( + uniffiClonePointer(), + status, + ); + }, null); } - static int allocationSize(MoqVideoFormat _value) { - return 4; + Future readFrame() { + return uniffiRustCallAsync( + () => uniffi_moq_ffi_fn_method_moqgroupconsumer_read_frame( + uniffiClonePointer(), + ), + ffi_moq_ffi_rust_future_poll_rust_buffer, + ffi_moq_ffi_rust_future_complete_rust_buffer, + ffi_moq_ffi_rust_future_free_rust_buffer, + FfiConverterOptionalMoqFrame.lift, + moqExceptionErrorHandler, + ); } - static int write(MoqVideoFormat value, Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, value.index + 1); - return 4; + int sequence() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqgroupconsumer_sequence( + uniffiClonePointer(), + status, + ), + FfiConverterUInt64.lift, + null, + ); } } -abstract class MoqAnnounceEvent { - RustBuffer lower(); - int allocationSize(); - int write(Uint8List buf); -} - -class FfiConverterMoqAnnounceEvent { - static MoqAnnounceEvent lift(RustBuffer buffer) { - return FfiConverterMoqAnnounceEvent.read(buffer.asUint8List()).value; +class FfiConverterMoqGroupConsumer { + static MoqGroupConsumer lift(Pointer ptr) { + return MoqGroupConsumer.lift(ptr); } - static LiftRetVal read(Uint8List buf) { - final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); - final subview = Uint8List.view(buf.buffer, buf.offsetInBytes + 4); - switch (index) { - case 1: - final lifted = StartMoqAnnounceEvent.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 2: - final lifted = UpdateMoqAnnounceEvent.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 3: - final lifted = EndMoqAnnounceEvent.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - case 4: - final lifted = RestartMoqAnnounceEvent.read(subview); - return LiftRetVal( - lifted.value, - lifted.bytesRead - subview.offsetInBytes + 4, - ); - default: - throw UniffiInternalError( - UniffiInternalError.unexpectedEnumCase, - "Unable to determine enum variant", - ); - } + static Pointer lower(MoqGroupConsumer value) { + return value.uniffiClonePointer(); } - static RustBuffer lower(MoqAnnounceEvent value) { - return value.lower(); + static int allocationSize(MoqGroupConsumer value) { + return 8; } - static int allocationSize(MoqAnnounceEvent value) { - return value.allocationSize(); + static LiftRetVal read(Uint8List buf) { + final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); + final pointer = Pointer.fromAddress(handle); + return LiftRetVal(MoqGroupConsumer.lift(pointer), 8); } - static int write(MoqAnnounceEvent value, Uint8List buf) { - return value.write(buf) - buf.offsetInBytes; + static int write(MoqGroupConsumer value, Uint8List buf) { + final handle = lower(value); + buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); + return 8; } } -class StartMoqAnnounceEvent extends MoqAnnounceEvent { - final MoqAnnounce announce; - StartMoqAnnounceEvent(MoqAnnounce this.announce); - StartMoqAnnounceEvent._(MoqAnnounce this.announce); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final announce_lifted = FfiConverterMoqAnnounce.read( - Uint8List.view(buf.buffer, new_offset), +abstract class MoqTrackConsumerInterface { + void cancel(); + MoqTrackInfo info(); + Future nextGroup(); + Future readFrame(); + Future recvDatagram(); + Future recvGroup(); + void update({required MoqSubscription subscription}); +} + +final _MoqTrackConsumerFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_moq_ffi_fn_free_moqtrackconsumer(ptr, status)); +}); + +class MoqTrackConsumer implements MoqTrackConsumerInterface { + late final Pointer _ptr; + bool _isDisposed = false; + MoqTrackConsumer._(this._ptr) { + _MoqTrackConsumerFinalizer.attach(this, _ptr, detach: this); + } + factory MoqTrackConsumer.lift(Pointer ptr) { + return MoqTrackConsumer._(ptr); + } + Pointer uniffiClonePointer() { + if (_isDisposed) { + throw StateError("Object has already been disposed"); + } + return rustCall( + (status) => uniffi_moq_ffi_fn_clone_moqtrackconsumer(_ptr, status), ); - final announce = announce_lifted.value; - new_offset += announce_lifted.bytesRead; - return LiftRetVal(StartMoqAnnounceEvent._(announce), new_offset); } - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); + void dispose() { + if (_isDisposed) { + return; + } + _isDisposed = true; + _MoqTrackConsumerFinalizer.detach(this); + rustCall((status) => uniffi_moq_ffi_fn_free_moqtrackconsumer(_ptr, status)); } - @override - int allocationSize() { - return FfiConverterMoqAnnounce.allocationSize(announce) + 4; + void cancel() { + return rustCall((status) { + uniffi_moq_ffi_fn_method_moqtrackconsumer_cancel( + uniffiClonePointer(), + status, + ); + }, null); } - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); - int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterMoqAnnounce.write( - announce, - Uint8List.view(buf.buffer, new_offset), + MoqTrackInfo info() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqtrackconsumer_info( + uniffiClonePointer(), + status, + ), + FfiConverterMoqTrackInfo.lift, + moqExceptionErrorHandler, ); - return new_offset; } -} -class UpdateMoqAnnounceEvent extends MoqAnnounceEvent { - final MoqAnnounce announce; - UpdateMoqAnnounceEvent(MoqAnnounce this.announce); - UpdateMoqAnnounceEvent._(MoqAnnounce this.announce); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final announce_lifted = FfiConverterMoqAnnounce.read( - Uint8List.view(buf.buffer, new_offset), + Future nextGroup() { + return uniffiRustCallAsync( + () => uniffi_moq_ffi_fn_method_moqtrackconsumer_next_group( + uniffiClonePointer(), + ), + ffi_moq_ffi_rust_future_poll_rust_buffer, + ffi_moq_ffi_rust_future_complete_rust_buffer, + ffi_moq_ffi_rust_future_free_rust_buffer, + FfiConverterOptionalMoqGroupConsumer.lift, + moqExceptionErrorHandler, ); - final announce = announce_lifted.value; - new_offset += announce_lifted.bytesRead; - return LiftRetVal(UpdateMoqAnnounceEvent._(announce), new_offset); } - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); + Future readFrame() { + return uniffiRustCallAsync( + () => uniffi_moq_ffi_fn_method_moqtrackconsumer_read_frame( + uniffiClonePointer(), + ), + ffi_moq_ffi_rust_future_poll_rust_buffer, + ffi_moq_ffi_rust_future_complete_rust_buffer, + ffi_moq_ffi_rust_future_free_rust_buffer, + FfiConverterOptionalMoqFrame.lift, + moqExceptionErrorHandler, + ); } - @override - int allocationSize() { - return FfiConverterMoqAnnounce.allocationSize(announce) + 4; + Future recvDatagram() { + return uniffiRustCallAsync( + () => uniffi_moq_ffi_fn_method_moqtrackconsumer_recv_datagram( + uniffiClonePointer(), + ), + ffi_moq_ffi_rust_future_poll_rust_buffer, + ffi_moq_ffi_rust_future_complete_rust_buffer, + ffi_moq_ffi_rust_future_free_rust_buffer, + FfiConverterOptionalMoqDatagram.lift, + moqExceptionErrorHandler, + ); + } + + Future recvGroup() { + return uniffiRustCallAsync( + () => uniffi_moq_ffi_fn_method_moqtrackconsumer_recv_group( + uniffiClonePointer(), + ), + ffi_moq_ffi_rust_future_poll_rust_buffer, + ffi_moq_ffi_rust_future_complete_rust_buffer, + ffi_moq_ffi_rust_future_free_rust_buffer, + FfiConverterOptionalMoqGroupConsumer.lift, + moqExceptionErrorHandler, + ); } - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 2); - int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterMoqAnnounce.write( - announce, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset; + void update({required MoqSubscription subscription}) { + return rustCall((status) { + uniffi_moq_ffi_fn_method_moqtrackconsumer_update( + uniffiClonePointer(), + FfiConverterMoqSubscription.lower(subscription), + status, + ); + }, null); } } -class EndMoqAnnounceEvent extends MoqAnnounceEvent { - final MoqAnnounce announce; - EndMoqAnnounceEvent(MoqAnnounce this.announce); - EndMoqAnnounceEvent._(MoqAnnounce this.announce); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final announce_lifted = FfiConverterMoqAnnounce.read( - Uint8List.view(buf.buffer, new_offset), - ); - final announce = announce_lifted.value; - new_offset += announce_lifted.bytesRead; - return LiftRetVal(EndMoqAnnounceEvent._(announce), new_offset); +class FfiConverterMoqTrackConsumer { + static MoqTrackConsumer lift(Pointer ptr) { + return MoqTrackConsumer.lift(ptr); } - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); + static Pointer lower(MoqTrackConsumer value) { + return value.uniffiClonePointer(); } - @override - int allocationSize() { - return FfiConverterMoqAnnounce.allocationSize(announce) + 4; + static int allocationSize(MoqTrackConsumer value) { + return 8; } - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 3); - int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterMoqAnnounce.write( - announce, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset; + static LiftRetVal read(Uint8List buf) { + final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); + final pointer = Pointer.fromAddress(handle); + return LiftRetVal(MoqTrackConsumer.lift(pointer), 8); } -} -class RestartMoqAnnounceEvent extends MoqAnnounceEvent { - final MoqAnnounce announce; - RestartMoqAnnounceEvent(MoqAnnounce this.announce); - RestartMoqAnnounceEvent._(MoqAnnounce this.announce); - static LiftRetVal read(Uint8List buf) { - int new_offset = buf.offsetInBytes; - final announce_lifted = FfiConverterMoqAnnounce.read( - Uint8List.view(buf.buffer, new_offset), - ); - final announce = announce_lifted.value; - new_offset += announce_lifted.bytesRead; - return LiftRetVal(RestartMoqAnnounceEvent._(announce), new_offset); + static int write(MoqTrackConsumer value, Uint8List buf) { + final handle = lower(value); + buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); + return 8; } +} - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); - } +abstract class MoqGroupDemandInterface { + bool isUsed(); + int sequence(); + Future unused(); + Future used(); +} - @override - int allocationSize() { - return FfiConverterMoqAnnounce.allocationSize(announce) + 4; - } +final _MoqGroupDemandFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_moq_ffi_fn_free_moqgroupdemand(ptr, status)); +}); - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 4); - int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterMoqAnnounce.write( - announce, - Uint8List.view(buf.buffer, new_offset), +class MoqGroupDemand implements MoqGroupDemandInterface { + late final Pointer _ptr; + bool _isDisposed = false; + MoqGroupDemand._(this._ptr) { + _MoqGroupDemandFinalizer.attach(this, _ptr, detach: this); + } + factory MoqGroupDemand.lift(Pointer ptr) { + return MoqGroupDemand._(ptr); + } + Pointer uniffiClonePointer() { + if (_isDisposed) { + throw StateError("Object has already been disposed"); + } + return rustCall( + (status) => uniffi_moq_ffi_fn_clone_moqgroupdemand(_ptr, status), ); - return new_offset; } -} - -enum MoqTransport { quic, iroh, webSocket, tcp, unix, webTransport } -class FfiConverterMoqTransport { - static LiftRetVal read(Uint8List buf) { - final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); - switch (index) { - case 1: - return LiftRetVal(MoqTransport.quic, 4); - case 2: - return LiftRetVal(MoqTransport.iroh, 4); - case 3: - return LiftRetVal(MoqTransport.webSocket, 4); - case 4: - return LiftRetVal(MoqTransport.tcp, 4); - case 5: - return LiftRetVal(MoqTransport.unix, 4); - case 6: - return LiftRetVal(MoqTransport.webTransport, 4); - default: - throw UniffiInternalError( - UniffiInternalError.unexpectedEnumCase, - "Unable to determine enum variant", - ); + void dispose() { + if (_isDisposed) { + return; } + _isDisposed = true; + _MoqGroupDemandFinalizer.detach(this); + rustCall((status) => uniffi_moq_ffi_fn_free_moqgroupdemand(_ptr, status)); } - static MoqTransport lift(RustBuffer buffer) { - return FfiConverterMoqTransport.read(buffer.asUint8List()).value; + bool isUsed() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqgroupdemand_is_used( + uniffiClonePointer(), + status, + ), + FfiConverterBool.lift, + null, + ); } - static RustBuffer lower(MoqTransport input) { - return toRustBuffer(createUint8ListFromInt(input.index + 1)); + int sequence() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqgroupdemand_sequence( + uniffiClonePointer(), + status, + ), + FfiConverterUInt64.lift, + null, + ); } - static int allocationSize(MoqTransport _value) { - return 4; + Future unused() { + return uniffiRustCallAsync( + () => + uniffi_moq_ffi_fn_method_moqgroupdemand_unused(uniffiClonePointer()), + ffi_moq_ffi_rust_future_poll_void, + ffi_moq_ffi_rust_future_complete_void, + ffi_moq_ffi_rust_future_free_void, + (_) {}, + moqExceptionErrorHandler, + ); } - static int write(MoqTransport value, Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, value.index + 1); - return 4; + Future used() { + return uniffiRustCallAsync( + () => uniffi_moq_ffi_fn_method_moqgroupdemand_used(uniffiClonePointer()), + ffi_moq_ffi_rust_future_poll_void, + ffi_moq_ffi_rust_future_complete_void, + ffi_moq_ffi_rust_future_free_void, + (_) {}, + moqExceptionErrorHandler, + ); } } -enum MoqConnectionStatus { connected, disconnected, migrating } - -class FfiConverterMoqConnectionStatus { - static LiftRetVal read(Uint8List buf) { - final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); - switch (index) { - case 1: - return LiftRetVal(MoqConnectionStatus.connected, 4); - case 2: - return LiftRetVal(MoqConnectionStatus.disconnected, 4); - case 3: - return LiftRetVal(MoqConnectionStatus.migrating, 4); - default: - throw UniffiInternalError( - UniffiInternalError.unexpectedEnumCase, - "Unable to determine enum variant", - ); - } +class FfiConverterMoqGroupDemand { + static MoqGroupDemand lift(Pointer ptr) { + return MoqGroupDemand.lift(ptr); } - static MoqConnectionStatus lift(RustBuffer buffer) { - return FfiConverterMoqConnectionStatus.read(buffer.asUint8List()).value; + static Pointer lower(MoqGroupDemand value) { + return value.uniffiClonePointer(); } - static RustBuffer lower(MoqConnectionStatus input) { - return toRustBuffer(createUint8ListFromInt(input.index + 1)); + static int allocationSize(MoqGroupDemand value) { + return 8; } - static int allocationSize(MoqConnectionStatus _value) { - return 4; + static LiftRetVal read(Uint8List buf) { + final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); + final pointer = Pointer.fromAddress(handle); + return LiftRetVal(MoqGroupDemand.lift(pointer), 8); } - static int write(MoqConnectionStatus value, Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, value.index + 1); - return 4; + static int write(MoqGroupDemand value, Uint8List buf) { + final handle = lower(value); + buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); + return 8; } } -abstract class MoqBandwidthInterface { - MoqReservation reserve({required MoqTrackDemand demand, required int maxBps}); +abstract class MoqTrackDemandInterface { + bool isUsed(); + String name(); + Future unused(); + Future used(); } -final _MoqBandwidthFinalizer = Finalizer>((ptr) { - rustCall((status) => uniffi_moq_ffi_fn_free_moqbandwidth(ptr, status)); +final _MoqTrackDemandFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_moq_ffi_fn_free_moqtrackdemand(ptr, status)); }); -class MoqBandwidth implements MoqBandwidthInterface { +class MoqTrackDemand implements MoqTrackDemandInterface { late final Pointer _ptr; bool _isDisposed = false; - MoqBandwidth._(this._ptr) { - _MoqBandwidthFinalizer.attach(this, _ptr, detach: this); - } - factory MoqBandwidth.lift(Pointer ptr) { - return MoqBandwidth._(ptr); + MoqTrackDemand._(this._ptr) { + _MoqTrackDemandFinalizer.attach(this, _ptr, detach: this); + } + factory MoqTrackDemand.lift(Pointer ptr) { + return MoqTrackDemand._(ptr); } Pointer uniffiClonePointer() { if (_isDisposed) { throw StateError("Object has already been disposed"); } return rustCall( - (status) => uniffi_moq_ffi_fn_clone_moqbandwidth(_ptr, status), + (status) => uniffi_moq_ffi_fn_clone_moqtrackdemand(_ptr, status), ); } @@ -5334,77 +7907,124 @@ class MoqBandwidth implements MoqBandwidthInterface { return; } _isDisposed = true; - _MoqBandwidthFinalizer.detach(this); - rustCall((status) => uniffi_moq_ffi_fn_free_moqbandwidth(_ptr, status)); + _MoqTrackDemandFinalizer.detach(this); + rustCall((status) => uniffi_moq_ffi_fn_free_moqtrackdemand(_ptr, status)); } - MoqReservation reserve({ - required MoqTrackDemand demand, - required int maxBps, - }) { + bool isUsed() { return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqbandwidth_reserve( + (status) => uniffi_moq_ffi_fn_method_moqtrackdemand_is_used( uniffiClonePointer(), - FfiConverterMoqTrackDemand.lower(demand), - FfiConverterUInt64.lower(maxBps), status, ), - FfiConverterMoqReservation.lift, + FfiConverterBool.lift, + null, + ); + } + + String name() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqtrackdemand_name( + uniffiClonePointer(), + status, + ), + FfiConverterString.lift, null, ); } + + Future unused() { + return uniffiRustCallAsync( + () => + uniffi_moq_ffi_fn_method_moqtrackdemand_unused(uniffiClonePointer()), + ffi_moq_ffi_rust_future_poll_void, + ffi_moq_ffi_rust_future_complete_void, + ffi_moq_ffi_rust_future_free_void, + (_) {}, + moqExceptionErrorHandler, + ); + } + + Future used() { + return uniffiRustCallAsync( + () => uniffi_moq_ffi_fn_method_moqtrackdemand_used(uniffiClonePointer()), + ffi_moq_ffi_rust_future_poll_void, + ffi_moq_ffi_rust_future_complete_void, + ffi_moq_ffi_rust_future_free_void, + (_) {}, + moqExceptionErrorHandler, + ); + } } -class FfiConverterMoqBandwidth { - static MoqBandwidth lift(Pointer ptr) { - return MoqBandwidth.lift(ptr); +class FfiConverterMoqTrackDemand { + static MoqTrackDemand lift(Pointer ptr) { + return MoqTrackDemand.lift(ptr); } - static Pointer lower(MoqBandwidth value) { + static Pointer lower(MoqTrackDemand value) { return value.uniffiClonePointer(); } - static int allocationSize(MoqBandwidth value) { + static int allocationSize(MoqTrackDemand value) { return 8; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); final pointer = Pointer.fromAddress(handle); - return LiftRetVal(MoqBandwidth.lift(pointer), 8); + return LiftRetVal(MoqTrackDemand.lift(pointer), 8); } - static int write(MoqBandwidth value, Uint8List buf) { + static int write(MoqTrackDemand value, Uint8List buf) { final handle = lower(value); buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); return 8; } } -abstract class MoqReservationInterface { - int? grant(); - void update({required int maxBps}); +abstract class MoqFlateSnapshotProducerInterface { + void finish(); + void update({required Uint8List payload, int? timestampUs = null}); } -final _MoqReservationFinalizer = Finalizer>((ptr) { - rustCall((status) => uniffi_moq_ffi_fn_free_moqreservation(ptr, status)); +final _MoqFlateSnapshotProducerFinalizer = Finalizer>((ptr) { + rustCall( + (status) => uniffi_moq_ffi_fn_free_moqflatesnapshotproducer(ptr, status), + ); }); -class MoqReservation implements MoqReservationInterface { +class MoqFlateSnapshotProducer implements MoqFlateSnapshotProducerInterface { late final Pointer _ptr; bool _isDisposed = false; - MoqReservation._(this._ptr) { - _MoqReservationFinalizer.attach(this, _ptr, detach: this); + MoqFlateSnapshotProducer._(this._ptr) { + _MoqFlateSnapshotProducerFinalizer.attach(this, _ptr, detach: this); } - factory MoqReservation.lift(Pointer ptr) { - return MoqReservation._(ptr); + MoqFlateSnapshotProducer({ + required MoqBroadcastProducer broadcast, + required MoqTrackProducer track, + required MoqFlateConfig config, + }) : _ptr = rustCall( + (status) => uniffi_moq_ffi_fn_constructor_moqflatesnapshotproducer_new( + FfiConverterMoqBroadcastProducer.lower(broadcast), + FfiConverterMoqTrackProducer.lower(track), + FfiConverterMoqFlateConfig.lower(config), + status, + ), + moqExceptionErrorHandler, + ) { + _MoqFlateSnapshotProducerFinalizer.attach(this, _ptr, detach: this); + } + factory MoqFlateSnapshotProducer.lift(Pointer ptr) { + return MoqFlateSnapshotProducer._(ptr); } Pointer uniffiClonePointer() { if (_isDisposed) { throw StateError("Object has already been disposed"); } return rustCall( - (status) => uniffi_moq_ffi_fn_clone_moqreservation(_ptr, status), + (status) => + uniffi_moq_ffi_fn_clone_moqflatesnapshotproducer(_ptr, status), ); } @@ -5413,92 +8033,100 @@ class MoqReservation implements MoqReservationInterface { return; } _isDisposed = true; - _MoqReservationFinalizer.detach(this); - rustCall((status) => uniffi_moq_ffi_fn_free_moqreservation(_ptr, status)); + _MoqFlateSnapshotProducerFinalizer.detach(this); + rustCall( + (status) => uniffi_moq_ffi_fn_free_moqflatesnapshotproducer(_ptr, status), + ); } - int? grant() { - return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqreservation_grant( + void finish() { + return rustCall((status) { + uniffi_moq_ffi_fn_method_moqflatesnapshotproducer_finish( uniffiClonePointer(), status, - ), - FfiConverterOptionalUInt64.lift, - null, - ); + ); + }, moqExceptionErrorHandler); } - void update({required int maxBps}) { + void update({required Uint8List payload, int? timestampUs = null}) { return rustCall((status) { - uniffi_moq_ffi_fn_method_moqreservation_update( + uniffi_moq_ffi_fn_method_moqflatesnapshotproducer_update( uniffiClonePointer(), - FfiConverterUInt64.lower(maxBps), + FfiConverterUint8List.lower(payload), + FfiConverterOptionalUInt64.lower(timestampUs), status, ); - }, null); + }, moqExceptionErrorHandler); } } -class FfiConverterMoqReservation { - static MoqReservation lift(Pointer ptr) { - return MoqReservation.lift(ptr); +class FfiConverterMoqFlateSnapshotProducer { + static MoqFlateSnapshotProducer lift(Pointer ptr) { + return MoqFlateSnapshotProducer.lift(ptr); } - static Pointer lower(MoqReservation value) { + static Pointer lower(MoqFlateSnapshotProducer value) { return value.uniffiClonePointer(); } - static int allocationSize(MoqReservation value) { + static int allocationSize(MoqFlateSnapshotProducer value) { return 8; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); final pointer = Pointer.fromAddress(handle); - return LiftRetVal(MoqReservation.lift(pointer), 8); + return LiftRetVal(MoqFlateSnapshotProducer.lift(pointer), 8); } - static int write(MoqReservation value, Uint8List buf) { + static int write(MoqFlateSnapshotProducer value, Uint8List buf) { final handle = lower(value); buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); return 8; } } -abstract class MoqBroadcastConsumerInterface { - Future fetchGroup({ - required String name, - required int sequence, - required MoqFetchGroupOptions? options, - }); - Future resolve({required String? reference}); - Future subscribeTrack({ - required String name, - required MoqSubscription? subscription, - }); +abstract class MoqFlateStreamProducerInterface { + void append({required Uint8List payload, int? timestampUs = null}); + void finish(); } -final _MoqBroadcastConsumerFinalizer = Finalizer>((ptr) { +final _MoqFlateStreamProducerFinalizer = Finalizer>((ptr) { rustCall( - (status) => uniffi_moq_ffi_fn_free_moqbroadcastconsumer(ptr, status), + (status) => uniffi_moq_ffi_fn_free_moqflatestreamproducer(ptr, status), ); }); -class MoqBroadcastConsumer implements MoqBroadcastConsumerInterface { +class MoqFlateStreamProducer implements MoqFlateStreamProducerInterface { late final Pointer _ptr; bool _isDisposed = false; - MoqBroadcastConsumer._(this._ptr) { - _MoqBroadcastConsumerFinalizer.attach(this, _ptr, detach: this); + MoqFlateStreamProducer._(this._ptr) { + _MoqFlateStreamProducerFinalizer.attach(this, _ptr, detach: this); } - factory MoqBroadcastConsumer.lift(Pointer ptr) { - return MoqBroadcastConsumer._(ptr); + MoqFlateStreamProducer({ + required MoqBroadcastProducer broadcast, + required MoqTrackProducer track, + required MoqFlateConfig config, + }) : _ptr = rustCall( + (status) => uniffi_moq_ffi_fn_constructor_moqflatestreamproducer_new( + FfiConverterMoqBroadcastProducer.lower(broadcast), + FfiConverterMoqTrackProducer.lower(track), + FfiConverterMoqFlateConfig.lower(config), + status, + ), + moqExceptionErrorHandler, + ) { + _MoqFlateStreamProducerFinalizer.attach(this, _ptr, detach: this); + } + factory MoqFlateStreamProducer.lift(Pointer ptr) { + return MoqFlateStreamProducer._(ptr); } Pointer uniffiClonePointer() { if (_isDisposed) { throw StateError("Object has already been disposed"); } return rustCall( - (status) => uniffi_moq_ffi_fn_clone_moqbroadcastconsumer(_ptr, status), + (status) => uniffi_moq_ffi_fn_clone_moqflatestreamproducer(_ptr, status), ); } @@ -5507,119 +8135,98 @@ class MoqBroadcastConsumer implements MoqBroadcastConsumerInterface { return; } _isDisposed = true; - _MoqBroadcastConsumerFinalizer.detach(this); + _MoqFlateStreamProducerFinalizer.detach(this); rustCall( - (status) => uniffi_moq_ffi_fn_free_moqbroadcastconsumer(_ptr, status), - ); - } - - Future fetchGroup({ - required String name, - required int sequence, - required MoqFetchGroupOptions? options, - }) { - return uniffiRustCallAsync( - () => uniffi_moq_ffi_fn_method_moqbroadcastconsumer_fetch_group( - uniffiClonePointer(), - FfiConverterString.lower(name), - FfiConverterUInt64.lower(sequence), - FfiConverterOptionalMoqFetchGroupOptions.lower(options), - ), - ffi_moq_ffi_rust_future_poll_u64, - ffi_moq_ffi_rust_future_complete_u64, - ffi_moq_ffi_rust_future_free_u64, - (ptr) => - FfiConverterMoqGroupConsumer.lift(Pointer.fromAddress(ptr)), - moqExceptionErrorHandler, - ); - } - - Future resolve({required String? reference}) { - return uniffiRustCallAsync( - () => uniffi_moq_ffi_fn_method_moqbroadcastconsumer_resolve( - uniffiClonePointer(), - FfiConverterOptionalString.lower(reference), - ), - ffi_moq_ffi_rust_future_poll_u64, - ffi_moq_ffi_rust_future_complete_u64, - ffi_moq_ffi_rust_future_free_u64, - (ptr) => - FfiConverterMoqBroadcastConsumer.lift(Pointer.fromAddress(ptr)), - moqExceptionErrorHandler, - ); - } - - Future subscribeTrack({ - required String name, - required MoqSubscription? subscription, - }) { - return uniffiRustCallAsync( - () => uniffi_moq_ffi_fn_method_moqbroadcastconsumer_subscribe_track( - uniffiClonePointer(), - FfiConverterString.lower(name), - FfiConverterOptionalMoqSubscription.lower(subscription), - ), - ffi_moq_ffi_rust_future_poll_u64, - ffi_moq_ffi_rust_future_complete_u64, - ffi_moq_ffi_rust_future_free_u64, - (ptr) => - FfiConverterMoqTrackConsumer.lift(Pointer.fromAddress(ptr)), - moqExceptionErrorHandler, + (status) => uniffi_moq_ffi_fn_free_moqflatestreamproducer(_ptr, status), ); } + + void append({required Uint8List payload, int? timestampUs = null}) { + return rustCall((status) { + uniffi_moq_ffi_fn_method_moqflatestreamproducer_append( + uniffiClonePointer(), + FfiConverterUint8List.lower(payload), + FfiConverterOptionalUInt64.lower(timestampUs), + status, + ); + }, moqExceptionErrorHandler); + } + + void finish() { + return rustCall((status) { + uniffi_moq_ffi_fn_method_moqflatestreamproducer_finish( + uniffiClonePointer(), + status, + ); + }, moqExceptionErrorHandler); + } } -class FfiConverterMoqBroadcastConsumer { - static MoqBroadcastConsumer lift(Pointer ptr) { - return MoqBroadcastConsumer.lift(ptr); +class FfiConverterMoqFlateStreamProducer { + static MoqFlateStreamProducer lift(Pointer ptr) { + return MoqFlateStreamProducer.lift(ptr); } - static Pointer lower(MoqBroadcastConsumer value) { + static Pointer lower(MoqFlateStreamProducer value) { return value.uniffiClonePointer(); } - static int allocationSize(MoqBroadcastConsumer value) { + static int allocationSize(MoqFlateStreamProducer value) { return 8; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); final pointer = Pointer.fromAddress(handle); - return LiftRetVal(MoqBroadcastConsumer.lift(pointer), 8); + return LiftRetVal(MoqFlateStreamProducer.lift(pointer), 8); } - static int write(MoqBroadcastConsumer value, Uint8List buf) { + static int write(MoqFlateStreamProducer value, Uint8List buf) { final handle = lower(value); buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); return 8; } } -abstract class MoqGroupConsumerInterface { +abstract class MoqJsonSnapshotConsumerInterface { void cancel(); - Future readFrame(); - int sequence(); + Future next(); } -final _MoqGroupConsumerFinalizer = Finalizer>((ptr) { - rustCall((status) => uniffi_moq_ffi_fn_free_moqgroupconsumer(ptr, status)); +final _MoqJsonSnapshotConsumerFinalizer = Finalizer>((ptr) { + rustCall( + (status) => uniffi_moq_ffi_fn_free_moqjsonsnapshotconsumer(ptr, status), + ); }); -class MoqGroupConsumer implements MoqGroupConsumerInterface { +class MoqJsonSnapshotConsumer implements MoqJsonSnapshotConsumerInterface { late final Pointer _ptr; bool _isDisposed = false; - MoqGroupConsumer._(this._ptr) { - _MoqGroupConsumerFinalizer.attach(this, _ptr, detach: this); + MoqJsonSnapshotConsumer._(this._ptr) { + _MoqJsonSnapshotConsumerFinalizer.attach(this, _ptr, detach: this); } - factory MoqGroupConsumer.lift(Pointer ptr) { - return MoqGroupConsumer._(ptr); + MoqJsonSnapshotConsumer({ + required MoqTrackConsumer track, + required MoqJsonSnapshotConfig config, + }) : _ptr = rustCall( + (status) => uniffi_moq_ffi_fn_constructor_moqjsonsnapshotconsumer_new( + FfiConverterMoqTrackConsumer.lower(track), + FfiConverterMoqJsonSnapshotConfig.lower(config), + status, + ), + moqExceptionErrorHandler, + ) { + _MoqJsonSnapshotConsumerFinalizer.attach(this, _ptr, detach: this); + } + factory MoqJsonSnapshotConsumer.lift(Pointer ptr) { + return MoqJsonSnapshotConsumer._(ptr); } Pointer uniffiClonePointer() { if (_isDisposed) { throw StateError("Object has already been disposed"); } return rustCall( - (status) => uniffi_moq_ffi_fn_clone_moqgroupconsumer(_ptr, status), + (status) => uniffi_moq_ffi_fn_clone_moqjsonsnapshotconsumer(_ptr, status), ); } @@ -5628,99 +8235,103 @@ class MoqGroupConsumer implements MoqGroupConsumerInterface { return; } _isDisposed = true; - _MoqGroupConsumerFinalizer.detach(this); - rustCall((status) => uniffi_moq_ffi_fn_free_moqgroupconsumer(_ptr, status)); + _MoqJsonSnapshotConsumerFinalizer.detach(this); + rustCall( + (status) => uniffi_moq_ffi_fn_free_moqjsonsnapshotconsumer(_ptr, status), + ); } void cancel() { return rustCall((status) { - uniffi_moq_ffi_fn_method_moqgroupconsumer_cancel( + uniffi_moq_ffi_fn_method_moqjsonsnapshotconsumer_cancel( uniffiClonePointer(), status, ); }, null); } - Future readFrame() { + Future next() { return uniffiRustCallAsync( - () => uniffi_moq_ffi_fn_method_moqgroupconsumer_read_frame( + () => uniffi_moq_ffi_fn_method_moqjsonsnapshotconsumer_next( uniffiClonePointer(), ), ffi_moq_ffi_rust_future_poll_rust_buffer, ffi_moq_ffi_rust_future_complete_rust_buffer, ffi_moq_ffi_rust_future_free_rust_buffer, - FfiConverterOptionalMoqFrame.lift, + FfiConverterOptionalString.lift, moqExceptionErrorHandler, ); } - - int sequence() { - return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqgroupconsumer_sequence( - uniffiClonePointer(), - status, - ), - FfiConverterUInt64.lift, - null, - ); - } } -class FfiConverterMoqGroupConsumer { - static MoqGroupConsumer lift(Pointer ptr) { - return MoqGroupConsumer.lift(ptr); +class FfiConverterMoqJsonSnapshotConsumer { + static MoqJsonSnapshotConsumer lift(Pointer ptr) { + return MoqJsonSnapshotConsumer.lift(ptr); } - static Pointer lower(MoqGroupConsumer value) { + static Pointer lower(MoqJsonSnapshotConsumer value) { return value.uniffiClonePointer(); } - static int allocationSize(MoqGroupConsumer value) { + static int allocationSize(MoqJsonSnapshotConsumer value) { return 8; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); final pointer = Pointer.fromAddress(handle); - return LiftRetVal(MoqGroupConsumer.lift(pointer), 8); + return LiftRetVal(MoqJsonSnapshotConsumer.lift(pointer), 8); } - static int write(MoqGroupConsumer value, Uint8List buf) { + static int write(MoqJsonSnapshotConsumer value, Uint8List buf) { final handle = lower(value); buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); return 8; } } -abstract class MoqTrackConsumerInterface { - void cancel(); - MoqTrackInfo info(); - Future nextGroup(); - Future readFrame(); - Future recvDatagram(); - Future recvGroup(); - void update({required MoqSubscription subscription}); +abstract class MoqJsonSnapshotProducerInterface { + MoqTrackDemand demand(); + void finish(); + void update({required String value, int? timestampUs = null}); } -final _MoqTrackConsumerFinalizer = Finalizer>((ptr) { - rustCall((status) => uniffi_moq_ffi_fn_free_moqtrackconsumer(ptr, status)); +final _MoqJsonSnapshotProducerFinalizer = Finalizer>((ptr) { + rustCall( + (status) => uniffi_moq_ffi_fn_free_moqjsonsnapshotproducer(ptr, status), + ); }); -class MoqTrackConsumer implements MoqTrackConsumerInterface { +class MoqJsonSnapshotProducer implements MoqJsonSnapshotProducerInterface { late final Pointer _ptr; bool _isDisposed = false; - MoqTrackConsumer._(this._ptr) { - _MoqTrackConsumerFinalizer.attach(this, _ptr, detach: this); + MoqJsonSnapshotProducer._(this._ptr) { + _MoqJsonSnapshotProducerFinalizer.attach(this, _ptr, detach: this); } - factory MoqTrackConsumer.lift(Pointer ptr) { - return MoqTrackConsumer._(ptr); + MoqJsonSnapshotProducer({ + required MoqBroadcastProducer broadcast, + required MoqTrackProducer track, + required MoqJsonSnapshotConfig config, + }) : _ptr = rustCall( + (status) => uniffi_moq_ffi_fn_constructor_moqjsonsnapshotproducer_new( + FfiConverterMoqBroadcastProducer.lower(broadcast), + FfiConverterMoqTrackProducer.lower(track), + FfiConverterMoqJsonSnapshotConfig.lower(config), + status, + ), + moqExceptionErrorHandler, + ) { + _MoqJsonSnapshotProducerFinalizer.attach(this, _ptr, detach: this); + } + factory MoqJsonSnapshotProducer.lift(Pointer ptr) { + return MoqJsonSnapshotProducer._(ptr); } Pointer uniffiClonePointer() { if (_isDisposed) { throw StateError("Object has already been disposed"); } return rustCall( - (status) => uniffi_moq_ffi_fn_clone_moqtrackconsumer(_ptr, status), + (status) => uniffi_moq_ffi_fn_clone_moqjsonsnapshotproducer(_ptr, status), ); } @@ -5729,145 +8340,109 @@ class MoqTrackConsumer implements MoqTrackConsumerInterface { return; } _isDisposed = true; - _MoqTrackConsumerFinalizer.detach(this); - rustCall((status) => uniffi_moq_ffi_fn_free_moqtrackconsumer(_ptr, status)); - } - - void cancel() { - return rustCall((status) { - uniffi_moq_ffi_fn_method_moqtrackconsumer_cancel( - uniffiClonePointer(), - status, - ); - }, null); + _MoqJsonSnapshotProducerFinalizer.detach(this); + rustCall( + (status) => uniffi_moq_ffi_fn_free_moqjsonsnapshotproducer(_ptr, status), + ); } - MoqTrackInfo info() { + MoqTrackDemand demand() { return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqtrackconsumer_info( + (status) => uniffi_moq_ffi_fn_method_moqjsonsnapshotproducer_demand( uniffiClonePointer(), status, ), - FfiConverterMoqTrackInfo.lift, - moqExceptionErrorHandler, - ); - } - - Future nextGroup() { - return uniffiRustCallAsync( - () => uniffi_moq_ffi_fn_method_moqtrackconsumer_next_group( - uniffiClonePointer(), - ), - ffi_moq_ffi_rust_future_poll_rust_buffer, - ffi_moq_ffi_rust_future_complete_rust_buffer, - ffi_moq_ffi_rust_future_free_rust_buffer, - FfiConverterOptionalMoqGroupConsumer.lift, - moqExceptionErrorHandler, - ); - } - - Future readFrame() { - return uniffiRustCallAsync( - () => uniffi_moq_ffi_fn_method_moqtrackconsumer_read_frame( - uniffiClonePointer(), - ), - ffi_moq_ffi_rust_future_poll_rust_buffer, - ffi_moq_ffi_rust_future_complete_rust_buffer, - ffi_moq_ffi_rust_future_free_rust_buffer, - FfiConverterOptionalMoqFrame.lift, - moqExceptionErrorHandler, - ); - } - - Future recvDatagram() { - return uniffiRustCallAsync( - () => uniffi_moq_ffi_fn_method_moqtrackconsumer_recv_datagram( - uniffiClonePointer(), - ), - ffi_moq_ffi_rust_future_poll_rust_buffer, - ffi_moq_ffi_rust_future_complete_rust_buffer, - ffi_moq_ffi_rust_future_free_rust_buffer, - FfiConverterOptionalMoqDatagram.lift, + FfiConverterMoqTrackDemand.lift, moqExceptionErrorHandler, ); } - Future recvGroup() { - return uniffiRustCallAsync( - () => uniffi_moq_ffi_fn_method_moqtrackconsumer_recv_group( + void finish() { + return rustCall((status) { + uniffi_moq_ffi_fn_method_moqjsonsnapshotproducer_finish( uniffiClonePointer(), - ), - ffi_moq_ffi_rust_future_poll_rust_buffer, - ffi_moq_ffi_rust_future_complete_rust_buffer, - ffi_moq_ffi_rust_future_free_rust_buffer, - FfiConverterOptionalMoqGroupConsumer.lift, - moqExceptionErrorHandler, - ); + status, + ); + }, moqExceptionErrorHandler); } - void update({required MoqSubscription subscription}) { + void update({required String value, int? timestampUs = null}) { return rustCall((status) { - uniffi_moq_ffi_fn_method_moqtrackconsumer_update( + uniffi_moq_ffi_fn_method_moqjsonsnapshotproducer_update( uniffiClonePointer(), - FfiConverterMoqSubscription.lower(subscription), + FfiConverterString.lower(value), + FfiConverterOptionalUInt64.lower(timestampUs), status, ); - }, null); + }, moqExceptionErrorHandler); } } -class FfiConverterMoqTrackConsumer { - static MoqTrackConsumer lift(Pointer ptr) { - return MoqTrackConsumer.lift(ptr); +class FfiConverterMoqJsonSnapshotProducer { + static MoqJsonSnapshotProducer lift(Pointer ptr) { + return MoqJsonSnapshotProducer.lift(ptr); } - static Pointer lower(MoqTrackConsumer value) { + static Pointer lower(MoqJsonSnapshotProducer value) { return value.uniffiClonePointer(); } - static int allocationSize(MoqTrackConsumer value) { + static int allocationSize(MoqJsonSnapshotProducer value) { return 8; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); final pointer = Pointer.fromAddress(handle); - return LiftRetVal(MoqTrackConsumer.lift(pointer), 8); + return LiftRetVal(MoqJsonSnapshotProducer.lift(pointer), 8); } - static int write(MoqTrackConsumer value, Uint8List buf) { + static int write(MoqJsonSnapshotProducer value, Uint8List buf) { final handle = lower(value); buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); return 8; } } -abstract class MoqGroupDemandInterface { - bool isUsed(); - int sequence(); - Future unused(); - Future used(); +abstract class MoqJsonStreamConsumerInterface { + void cancel(); + Future next(); } -final _MoqGroupDemandFinalizer = Finalizer>((ptr) { - rustCall((status) => uniffi_moq_ffi_fn_free_moqgroupdemand(ptr, status)); +final _MoqJsonStreamConsumerFinalizer = Finalizer>((ptr) { + rustCall( + (status) => uniffi_moq_ffi_fn_free_moqjsonstreamconsumer(ptr, status), + ); }); -class MoqGroupDemand implements MoqGroupDemandInterface { +class MoqJsonStreamConsumer implements MoqJsonStreamConsumerInterface { late final Pointer _ptr; bool _isDisposed = false; - MoqGroupDemand._(this._ptr) { - _MoqGroupDemandFinalizer.attach(this, _ptr, detach: this); + MoqJsonStreamConsumer._(this._ptr) { + _MoqJsonStreamConsumerFinalizer.attach(this, _ptr, detach: this); } - factory MoqGroupDemand.lift(Pointer ptr) { - return MoqGroupDemand._(ptr); + MoqJsonStreamConsumer({ + required MoqTrackConsumer track, + required MoqJsonStreamConfig config, + }) : _ptr = rustCall( + (status) => uniffi_moq_ffi_fn_constructor_moqjsonstreamconsumer_new( + FfiConverterMoqTrackConsumer.lower(track), + FfiConverterMoqJsonStreamConfig.lower(config), + status, + ), + moqExceptionErrorHandler, + ) { + _MoqJsonStreamConsumerFinalizer.attach(this, _ptr, detach: this); + } + factory MoqJsonStreamConsumer.lift(Pointer ptr) { + return MoqJsonStreamConsumer._(ptr); } Pointer uniffiClonePointer() { if (_isDisposed) { throw StateError("Object has already been disposed"); } return rustCall( - (status) => uniffi_moq_ffi_fn_clone_moqgroupdemand(_ptr, status), + (status) => uniffi_moq_ffi_fn_clone_moqjsonstreamconsumer(_ptr, status), ); } @@ -5876,108 +8451,103 @@ class MoqGroupDemand implements MoqGroupDemandInterface { return; } _isDisposed = true; - _MoqGroupDemandFinalizer.detach(this); - rustCall((status) => uniffi_moq_ffi_fn_free_moqgroupdemand(_ptr, status)); - } - - bool isUsed() { - return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqgroupdemand_is_used( - uniffiClonePointer(), - status, - ), - FfiConverterBool.lift, - null, + _MoqJsonStreamConsumerFinalizer.detach(this); + rustCall( + (status) => uniffi_moq_ffi_fn_free_moqjsonstreamconsumer(_ptr, status), ); } - int sequence() { - return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqgroupdemand_sequence( + void cancel() { + return rustCall((status) { + uniffi_moq_ffi_fn_method_moqjsonstreamconsumer_cancel( uniffiClonePointer(), status, - ), - FfiConverterUInt64.lift, - null, - ); - } - - Future unused() { - return uniffiRustCallAsync( - () => - uniffi_moq_ffi_fn_method_moqgroupdemand_unused(uniffiClonePointer()), - ffi_moq_ffi_rust_future_poll_void, - ffi_moq_ffi_rust_future_complete_void, - ffi_moq_ffi_rust_future_free_void, - (_) {}, - moqExceptionErrorHandler, - ); + ); + }, null); } - Future used() { + Future next() { return uniffiRustCallAsync( - () => uniffi_moq_ffi_fn_method_moqgroupdemand_used(uniffiClonePointer()), - ffi_moq_ffi_rust_future_poll_void, - ffi_moq_ffi_rust_future_complete_void, - ffi_moq_ffi_rust_future_free_void, - (_) {}, + () => uniffi_moq_ffi_fn_method_moqjsonstreamconsumer_next( + uniffiClonePointer(), + ), + ffi_moq_ffi_rust_future_poll_rust_buffer, + ffi_moq_ffi_rust_future_complete_rust_buffer, + ffi_moq_ffi_rust_future_free_rust_buffer, + FfiConverterOptionalString.lift, moqExceptionErrorHandler, ); } } -class FfiConverterMoqGroupDemand { - static MoqGroupDemand lift(Pointer ptr) { - return MoqGroupDemand.lift(ptr); +class FfiConverterMoqJsonStreamConsumer { + static MoqJsonStreamConsumer lift(Pointer ptr) { + return MoqJsonStreamConsumer.lift(ptr); } - static Pointer lower(MoqGroupDemand value) { + static Pointer lower(MoqJsonStreamConsumer value) { return value.uniffiClonePointer(); } - static int allocationSize(MoqGroupDemand value) { + static int allocationSize(MoqJsonStreamConsumer value) { return 8; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); final pointer = Pointer.fromAddress(handle); - return LiftRetVal(MoqGroupDemand.lift(pointer), 8); + return LiftRetVal(MoqJsonStreamConsumer.lift(pointer), 8); } - static int write(MoqGroupDemand value, Uint8List buf) { + static int write(MoqJsonStreamConsumer value, Uint8List buf) { final handle = lower(value); buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); return 8; } } -abstract class MoqTrackDemandInterface { - bool isUsed(); - String name(); - Future unused(); - Future used(); +abstract class MoqJsonStreamProducerInterface { + void append({required String value, int? timestampUs = null}); + MoqTrackDemand demand(); + void finish(); } -final _MoqTrackDemandFinalizer = Finalizer>((ptr) { - rustCall((status) => uniffi_moq_ffi_fn_free_moqtrackdemand(ptr, status)); +final _MoqJsonStreamProducerFinalizer = Finalizer>((ptr) { + rustCall( + (status) => uniffi_moq_ffi_fn_free_moqjsonstreamproducer(ptr, status), + ); }); -class MoqTrackDemand implements MoqTrackDemandInterface { +class MoqJsonStreamProducer implements MoqJsonStreamProducerInterface { late final Pointer _ptr; bool _isDisposed = false; - MoqTrackDemand._(this._ptr) { - _MoqTrackDemandFinalizer.attach(this, _ptr, detach: this); + MoqJsonStreamProducer._(this._ptr) { + _MoqJsonStreamProducerFinalizer.attach(this, _ptr, detach: this); } - factory MoqTrackDemand.lift(Pointer ptr) { - return MoqTrackDemand._(ptr); + MoqJsonStreamProducer({ + required MoqBroadcastProducer broadcast, + required MoqTrackProducer track, + required MoqJsonStreamConfig config, + }) : _ptr = rustCall( + (status) => uniffi_moq_ffi_fn_constructor_moqjsonstreamproducer_new( + FfiConverterMoqBroadcastProducer.lower(broadcast), + FfiConverterMoqTrackProducer.lower(track), + FfiConverterMoqJsonStreamConfig.lower(config), + status, + ), + moqExceptionErrorHandler, + ) { + _MoqJsonStreamProducerFinalizer.attach(this, _ptr, detach: this); + } + factory MoqJsonStreamProducer.lift(Pointer ptr) { + return MoqJsonStreamProducer._(ptr); } Pointer uniffiClonePointer() { if (_isDisposed) { throw StateError("Object has already been disposed"); } return rustCall( - (status) => uniffi_moq_ffi_fn_clone_moqtrackdemand(_ptr, status), + (status) => uniffi_moq_ffi_fn_clone_moqjsonstreamproducer(_ptr, status), ); } @@ -5986,124 +8556,112 @@ class MoqTrackDemand implements MoqTrackDemandInterface { return; } _isDisposed = true; - _MoqTrackDemandFinalizer.detach(this); - rustCall((status) => uniffi_moq_ffi_fn_free_moqtrackdemand(_ptr, status)); + _MoqJsonStreamProducerFinalizer.detach(this); + rustCall( + (status) => uniffi_moq_ffi_fn_free_moqjsonstreamproducer(_ptr, status), + ); } - bool isUsed() { - return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqtrackdemand_is_used( + void append({required String value, int? timestampUs = null}) { + return rustCall((status) { + uniffi_moq_ffi_fn_method_moqjsonstreamproducer_append( uniffiClonePointer(), + FfiConverterString.lower(value), + FfiConverterOptionalUInt64.lower(timestampUs), status, - ), - FfiConverterBool.lift, - null, - ); + ); + }, moqExceptionErrorHandler); } - String name() { + MoqTrackDemand demand() { return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqtrackdemand_name( + (status) => uniffi_moq_ffi_fn_method_moqjsonstreamproducer_demand( uniffiClonePointer(), status, ), - FfiConverterString.lift, - null, - ); - } - - Future unused() { - return uniffiRustCallAsync( - () => - uniffi_moq_ffi_fn_method_moqtrackdemand_unused(uniffiClonePointer()), - ffi_moq_ffi_rust_future_poll_void, - ffi_moq_ffi_rust_future_complete_void, - ffi_moq_ffi_rust_future_free_void, - (_) {}, + FfiConverterMoqTrackDemand.lift, moqExceptionErrorHandler, ); } - Future used() { - return uniffiRustCallAsync( - () => uniffi_moq_ffi_fn_method_moqtrackdemand_used(uniffiClonePointer()), - ffi_moq_ffi_rust_future_poll_void, - ffi_moq_ffi_rust_future_complete_void, - ffi_moq_ffi_rust_future_free_void, - (_) {}, - moqExceptionErrorHandler, - ); + void finish() { + return rustCall((status) { + uniffi_moq_ffi_fn_method_moqjsonstreamproducer_finish( + uniffiClonePointer(), + status, + ); + }, moqExceptionErrorHandler); } } -class FfiConverterMoqTrackDemand { - static MoqTrackDemand lift(Pointer ptr) { - return MoqTrackDemand.lift(ptr); +class FfiConverterMoqJsonStreamProducer { + static MoqJsonStreamProducer lift(Pointer ptr) { + return MoqJsonStreamProducer.lift(ptr); } - static Pointer lower(MoqTrackDemand value) { + static Pointer lower(MoqJsonStreamProducer value) { return value.uniffiClonePointer(); } - static int allocationSize(MoqTrackDemand value) { + static int allocationSize(MoqJsonStreamProducer value) { return 8; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); final pointer = Pointer.fromAddress(handle); - return LiftRetVal(MoqTrackDemand.lift(pointer), 8); + return LiftRetVal(MoqJsonStreamProducer.lift(pointer), 8); } - static int write(MoqTrackDemand value, Uint8List buf) { + static int write(MoqJsonStreamProducer value, Uint8List buf) { final handle = lower(value); buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); return 8; } } -abstract class MoqFlateSnapshotProducerInterface { - void finish(); - void update({required Uint8List payload, int? timestampUs = null}); +abstract class MoqMediaCatalogConsumerInterface { + void cancel(); + Future next(); } -final _MoqFlateSnapshotProducerFinalizer = Finalizer>((ptr) { +final _MoqMediaCatalogConsumerFinalizer = Finalizer>((ptr) { rustCall( - (status) => uniffi_moq_ffi_fn_free_moqflatesnapshotproducer(ptr, status), - ); -}); - -class MoqFlateSnapshotProducer implements MoqFlateSnapshotProducerInterface { - late final Pointer _ptr; - bool _isDisposed = false; - MoqFlateSnapshotProducer._(this._ptr) { - _MoqFlateSnapshotProducerFinalizer.attach(this, _ptr, detach: this); - } - MoqFlateSnapshotProducer({ - required MoqBroadcastProducer broadcast, - required MoqTrackProducer track, - required MoqFlateConfig config, - }) : _ptr = rustCall( - (status) => uniffi_moq_ffi_fn_constructor_moqflatesnapshotproducer_new( - FfiConverterMoqBroadcastProducer.lower(broadcast), - FfiConverterMoqTrackProducer.lower(track), - FfiConverterMoqFlateConfig.lower(config), - status, - ), - moqExceptionErrorHandler, - ) { - _MoqFlateSnapshotProducerFinalizer.attach(this, _ptr, detach: this); + (status) => uniffi_moq_ffi_fn_free_moqmediacatalogconsumer(ptr, status), + ); +}); + +class MoqMediaCatalogConsumer implements MoqMediaCatalogConsumerInterface { + late final Pointer _ptr; + bool _isDisposed = false; + MoqMediaCatalogConsumer._(this._ptr) { + _MoqMediaCatalogConsumerFinalizer.attach(this, _ptr, detach: this); } - factory MoqFlateSnapshotProducer.lift(Pointer ptr) { - return MoqFlateSnapshotProducer._(ptr); + static Future subscribe({ + required MoqBroadcastConsumer broadcast, + }) { + return uniffiRustCallAsync( + () => uniffi_moq_ffi_fn_constructor_moqmediacatalogconsumer_subscribe( + FfiConverterMoqBroadcastConsumer.lower(broadcast), + ), + ffi_moq_ffi_rust_future_poll_u64, + ffi_moq_ffi_rust_future_complete_u64, + ffi_moq_ffi_rust_future_free_u64, + (int handle) => + MoqMediaCatalogConsumer._(Pointer.fromAddress(handle)), + moqExceptionErrorHandler, + ); + } + + factory MoqMediaCatalogConsumer.lift(Pointer ptr) { + return MoqMediaCatalogConsumer._(ptr); } Pointer uniffiClonePointer() { if (_isDisposed) { throw StateError("Object has already been disposed"); } return rustCall( - (status) => - uniffi_moq_ffi_fn_clone_moqflatesnapshotproducer(_ptr, status), + (status) => uniffi_moq_ffi_fn_clone_moqmediacatalogconsumer(_ptr, status), ); } @@ -6112,100 +8670,99 @@ class MoqFlateSnapshotProducer implements MoqFlateSnapshotProducerInterface { return; } _isDisposed = true; - _MoqFlateSnapshotProducerFinalizer.detach(this); + _MoqMediaCatalogConsumerFinalizer.detach(this); rustCall( - (status) => uniffi_moq_ffi_fn_free_moqflatesnapshotproducer(_ptr, status), + (status) => uniffi_moq_ffi_fn_free_moqmediacatalogconsumer(_ptr, status), ); } - void finish() { + void cancel() { return rustCall((status) { - uniffi_moq_ffi_fn_method_moqflatesnapshotproducer_finish( + uniffi_moq_ffi_fn_method_moqmediacatalogconsumer_cancel( uniffiClonePointer(), status, ); - }, moqExceptionErrorHandler); + }, null); } - void update({required Uint8List payload, int? timestampUs = null}) { - return rustCall((status) { - uniffi_moq_ffi_fn_method_moqflatesnapshotproducer_update( + Future next() { + return uniffiRustCallAsync( + () => uniffi_moq_ffi_fn_method_moqmediacatalogconsumer_next( uniffiClonePointer(), - FfiConverterUint8List.lower(payload), - FfiConverterOptionalUInt64.lower(timestampUs), - status, - ); - }, moqExceptionErrorHandler); + ), + ffi_moq_ffi_rust_future_poll_rust_buffer, + ffi_moq_ffi_rust_future_complete_rust_buffer, + ffi_moq_ffi_rust_future_free_rust_buffer, + FfiConverterOptionalMoqCatalog.lift, + moqExceptionErrorHandler, + ); } } -class FfiConverterMoqFlateSnapshotProducer { - static MoqFlateSnapshotProducer lift(Pointer ptr) { - return MoqFlateSnapshotProducer.lift(ptr); +class FfiConverterMoqMediaCatalogConsumer { + static MoqMediaCatalogConsumer lift(Pointer ptr) { + return MoqMediaCatalogConsumer.lift(ptr); } - static Pointer lower(MoqFlateSnapshotProducer value) { + static Pointer lower(MoqMediaCatalogConsumer value) { return value.uniffiClonePointer(); } - static int allocationSize(MoqFlateSnapshotProducer value) { + static int allocationSize(MoqMediaCatalogConsumer value) { return 8; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); final pointer = Pointer.fromAddress(handle); - return LiftRetVal(MoqFlateSnapshotProducer.lift(pointer), 8); + return LiftRetVal(MoqMediaCatalogConsumer.lift(pointer), 8); } - static int write(MoqFlateSnapshotProducer value, Uint8List buf) { + static int write(MoqMediaCatalogConsumer value, Uint8List buf) { final handle = lower(value); buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); return 8; } } -abstract class MoqFlateStreamProducerInterface { - void append({required Uint8List payload, int? timestampUs = null}); - void finish(); +abstract class MoqMediaCatalogProducerInterface { + int now(); + void removeSection({required String name}); + void setSection({required String name, required String json}); + void setVideoProperties({required MoqVideoProperties properties}); } -final _MoqFlateStreamProducerFinalizer = Finalizer>((ptr) { +final _MoqMediaCatalogProducerFinalizer = Finalizer>((ptr) { rustCall( - (status) => uniffi_moq_ffi_fn_free_moqflatestreamproducer(ptr, status), + (status) => uniffi_moq_ffi_fn_free_moqmediacatalogproducer(ptr, status), ); }); -class MoqFlateStreamProducer implements MoqFlateStreamProducerInterface { +class MoqMediaCatalogProducer implements MoqMediaCatalogProducerInterface { late final Pointer _ptr; bool _isDisposed = false; - MoqFlateStreamProducer._(this._ptr) { - _MoqFlateStreamProducerFinalizer.attach(this, _ptr, detach: this); + MoqMediaCatalogProducer._(this._ptr) { + _MoqMediaCatalogProducerFinalizer.attach(this, _ptr, detach: this); } - MoqFlateStreamProducer({ - required MoqBroadcastProducer broadcast, - required MoqTrackProducer track, - required MoqFlateConfig config, - }) : _ptr = rustCall( - (status) => uniffi_moq_ffi_fn_constructor_moqflatestreamproducer_new( - FfiConverterMoqBroadcastProducer.lower(broadcast), - FfiConverterMoqTrackProducer.lower(track), - FfiConverterMoqFlateConfig.lower(config), - status, - ), - moqExceptionErrorHandler, - ) { - _MoqFlateStreamProducerFinalizer.attach(this, _ptr, detach: this); + MoqMediaCatalogProducer({required MoqBroadcastProducer broadcast}) + : _ptr = rustCall( + (status) => uniffi_moq_ffi_fn_constructor_moqmediacatalogproducer_new( + FfiConverterMoqBroadcastProducer.lower(broadcast), + status, + ), + moqExceptionErrorHandler, + ) { + _MoqMediaCatalogProducerFinalizer.attach(this, _ptr, detach: this); } - factory MoqFlateStreamProducer.lift(Pointer ptr) { - return MoqFlateStreamProducer._(ptr); + factory MoqMediaCatalogProducer.lift(Pointer ptr) { + return MoqMediaCatalogProducer._(ptr); } Pointer uniffiClonePointer() { if (_isDisposed) { throw StateError("Object has already been disposed"); } return rustCall( - (status) => uniffi_moq_ffi_fn_clone_moqflatestreamproducer(_ptr, status), + (status) => uniffi_moq_ffi_fn_clone_moqmediacatalogproducer(_ptr, status), ); } @@ -6214,98 +8771,124 @@ class MoqFlateStreamProducer implements MoqFlateStreamProducerInterface { return; } _isDisposed = true; - _MoqFlateStreamProducerFinalizer.detach(this); + _MoqMediaCatalogProducerFinalizer.detach(this); rustCall( - (status) => uniffi_moq_ffi_fn_free_moqflatestreamproducer(_ptr, status), + (status) => uniffi_moq_ffi_fn_free_moqmediacatalogproducer(_ptr, status), ); } - void append({required Uint8List payload, int? timestampUs = null}) { + int now() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqmediacatalogproducer_now( + uniffiClonePointer(), + status, + ), + FfiConverterUInt64.lift, + moqExceptionErrorHandler, + ); + } + + void removeSection({required String name}) { return rustCall((status) { - uniffi_moq_ffi_fn_method_moqflatestreamproducer_append( + uniffi_moq_ffi_fn_method_moqmediacatalogproducer_remove_section( uniffiClonePointer(), - FfiConverterUint8List.lower(payload), - FfiConverterOptionalUInt64.lower(timestampUs), + FfiConverterString.lower(name), status, ); }, moqExceptionErrorHandler); } - void finish() { + void setSection({required String name, required String json}) { return rustCall((status) { - uniffi_moq_ffi_fn_method_moqflatestreamproducer_finish( + uniffi_moq_ffi_fn_method_moqmediacatalogproducer_set_section( + uniffiClonePointer(), + FfiConverterString.lower(name), + FfiConverterString.lower(json), + status, + ); + }, moqExceptionErrorHandler); + } + + void setVideoProperties({required MoqVideoProperties properties}) { + return rustCall((status) { + uniffi_moq_ffi_fn_method_moqmediacatalogproducer_set_video_properties( uniffiClonePointer(), + FfiConverterMoqVideoProperties.lower(properties), status, ); }, moqExceptionErrorHandler); } } -class FfiConverterMoqFlateStreamProducer { - static MoqFlateStreamProducer lift(Pointer ptr) { - return MoqFlateStreamProducer.lift(ptr); +class FfiConverterMoqMediaCatalogProducer { + static MoqMediaCatalogProducer lift(Pointer ptr) { + return MoqMediaCatalogProducer.lift(ptr); } - static Pointer lower(MoqFlateStreamProducer value) { + static Pointer lower(MoqMediaCatalogProducer value) { return value.uniffiClonePointer(); } - static int allocationSize(MoqFlateStreamProducer value) { + static int allocationSize(MoqMediaCatalogProducer value) { return 8; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); final pointer = Pointer.fromAddress(handle); - return LiftRetVal(MoqFlateStreamProducer.lift(pointer), 8); + return LiftRetVal(MoqMediaCatalogProducer.lift(pointer), 8); } - static int write(MoqFlateStreamProducer value, Uint8List buf) { + static int write(MoqMediaCatalogProducer value, Uint8List buf) { final handle = lower(value); buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); return 8; } } -abstract class MoqJsonSnapshotConsumerInterface { - void cancel(); - Future next(); +abstract class MoqMediaContainerProducerInterface { + void cut(); + void finish(); + void seek({required int sequence}); + void write({required Uint8List payload}); } -final _MoqJsonSnapshotConsumerFinalizer = Finalizer>((ptr) { +final _MoqMediaContainerProducerFinalizer = Finalizer>((ptr) { rustCall( - (status) => uniffi_moq_ffi_fn_free_moqjsonsnapshotconsumer(ptr, status), + (status) => uniffi_moq_ffi_fn_free_moqmediacontainerproducer(ptr, status), ); }); -class MoqJsonSnapshotConsumer implements MoqJsonSnapshotConsumerInterface { +class MoqMediaContainerProducer implements MoqMediaContainerProducerInterface { late final Pointer _ptr; bool _isDisposed = false; - MoqJsonSnapshotConsumer._(this._ptr) { - _MoqJsonSnapshotConsumerFinalizer.attach(this, _ptr, detach: this); + MoqMediaContainerProducer._(this._ptr) { + _MoqMediaContainerProducerFinalizer.attach(this, _ptr, detach: this); } - MoqJsonSnapshotConsumer({ - required MoqTrackConsumer track, - required MoqJsonSnapshotConfig config, + MoqMediaContainerProducer({ + required MoqBroadcastProducer broadcast, + required MoqContainerInit init, }) : _ptr = rustCall( - (status) => uniffi_moq_ffi_fn_constructor_moqjsonsnapshotconsumer_new( - FfiConverterMoqTrackConsumer.lower(track), - FfiConverterMoqJsonSnapshotConfig.lower(config), - status, - ), + (status) => + uniffi_moq_ffi_fn_constructor_moqmediacontainerproducer_new( + FfiConverterMoqBroadcastProducer.lower(broadcast), + FfiConverterMoqContainerInit.lower(init), + status, + ), moqExceptionErrorHandler, ) { - _MoqJsonSnapshotConsumerFinalizer.attach(this, _ptr, detach: this); + _MoqMediaContainerProducerFinalizer.attach(this, _ptr, detach: this); } - factory MoqJsonSnapshotConsumer.lift(Pointer ptr) { - return MoqJsonSnapshotConsumer._(ptr); + factory MoqMediaContainerProducer.lift(Pointer ptr) { + return MoqMediaContainerProducer._(ptr); } Pointer uniffiClonePointer() { if (_isDisposed) { throw StateError("Object has already been disposed"); } return rustCall( - (status) => uniffi_moq_ffi_fn_clone_moqjsonsnapshotconsumer(_ptr, status), + (status) => + uniffi_moq_ffi_fn_clone_moqmediacontainerproducer(_ptr, status), ); } @@ -6314,103 +8897,123 @@ class MoqJsonSnapshotConsumer implements MoqJsonSnapshotConsumerInterface { return; } _isDisposed = true; - _MoqJsonSnapshotConsumerFinalizer.detach(this); + _MoqMediaContainerProducerFinalizer.detach(this); rustCall( - (status) => uniffi_moq_ffi_fn_free_moqjsonsnapshotconsumer(_ptr, status), + (status) => + uniffi_moq_ffi_fn_free_moqmediacontainerproducer(_ptr, status), ); } - void cancel() { + void cut() { + return rustCall((status) { + uniffi_moq_ffi_fn_method_moqmediacontainerproducer_cut( + uniffiClonePointer(), + status, + ); + }, moqExceptionErrorHandler); + } + + void finish() { + return rustCall((status) { + uniffi_moq_ffi_fn_method_moqmediacontainerproducer_finish( + uniffiClonePointer(), + status, + ); + }, moqExceptionErrorHandler); + } + + void seek({required int sequence}) { + return rustCall((status) { + uniffi_moq_ffi_fn_method_moqmediacontainerproducer_seek( + uniffiClonePointer(), + FfiConverterUInt64.lower(sequence), + status, + ); + }, moqExceptionErrorHandler); + } + + void write({required Uint8List payload}) { return rustCall((status) { - uniffi_moq_ffi_fn_method_moqjsonsnapshotconsumer_cancel( + uniffi_moq_ffi_fn_method_moqmediacontainerproducer_write( uniffiClonePointer(), + FfiConverterUint8List.lower(payload), status, ); - }, null); - } - - Future next() { - return uniffiRustCallAsync( - () => uniffi_moq_ffi_fn_method_moqjsonsnapshotconsumer_next( - uniffiClonePointer(), - ), - ffi_moq_ffi_rust_future_poll_rust_buffer, - ffi_moq_ffi_rust_future_complete_rust_buffer, - ffi_moq_ffi_rust_future_free_rust_buffer, - FfiConverterOptionalString.lift, - moqExceptionErrorHandler, - ); + }, moqExceptionErrorHandler); } } -class FfiConverterMoqJsonSnapshotConsumer { - static MoqJsonSnapshotConsumer lift(Pointer ptr) { - return MoqJsonSnapshotConsumer.lift(ptr); +class FfiConverterMoqMediaContainerProducer { + static MoqMediaContainerProducer lift(Pointer ptr) { + return MoqMediaContainerProducer.lift(ptr); } - static Pointer lower(MoqJsonSnapshotConsumer value) { + static Pointer lower(MoqMediaContainerProducer value) { return value.uniffiClonePointer(); } - static int allocationSize(MoqJsonSnapshotConsumer value) { + static int allocationSize(MoqMediaContainerProducer value) { return 8; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); final pointer = Pointer.fromAddress(handle); - return LiftRetVal(MoqJsonSnapshotConsumer.lift(pointer), 8); + return LiftRetVal(MoqMediaContainerProducer.lift(pointer), 8); } - static int write(MoqJsonSnapshotConsumer value, Uint8List buf) { + static int write(MoqMediaContainerProducer value, Uint8List buf) { final handle = lower(value); buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); return 8; } } -abstract class MoqJsonSnapshotProducerInterface { - MoqTrackDemand demand(); +abstract class MoqMediaContainerStreamProducerInterface { void finish(); - void update({required String value, int? timestampUs = null}); + void write({required Uint8List payload}); } -final _MoqJsonSnapshotProducerFinalizer = Finalizer>((ptr) { +final _MoqMediaContainerStreamProducerFinalizer = Finalizer>(( + ptr, +) { rustCall( - (status) => uniffi_moq_ffi_fn_free_moqjsonsnapshotproducer(ptr, status), + (status) => + uniffi_moq_ffi_fn_free_moqmediacontainerstreamproducer(ptr, status), ); }); -class MoqJsonSnapshotProducer implements MoqJsonSnapshotProducerInterface { +class MoqMediaContainerStreamProducer + implements MoqMediaContainerStreamProducerInterface { late final Pointer _ptr; bool _isDisposed = false; - MoqJsonSnapshotProducer._(this._ptr) { - _MoqJsonSnapshotProducerFinalizer.attach(this, _ptr, detach: this); + MoqMediaContainerStreamProducer._(this._ptr) { + _MoqMediaContainerStreamProducerFinalizer.attach(this, _ptr, detach: this); } - MoqJsonSnapshotProducer({ + MoqMediaContainerStreamProducer({ required MoqBroadcastProducer broadcast, - required MoqTrackProducer track, - required MoqJsonSnapshotConfig config, + required MoqContainerStreamInit init, }) : _ptr = rustCall( - (status) => uniffi_moq_ffi_fn_constructor_moqjsonsnapshotproducer_new( - FfiConverterMoqBroadcastProducer.lower(broadcast), - FfiConverterMoqTrackProducer.lower(track), - FfiConverterMoqJsonSnapshotConfig.lower(config), - status, - ), + (status) => + uniffi_moq_ffi_fn_constructor_moqmediacontainerstreamproducer_new( + FfiConverterMoqBroadcastProducer.lower(broadcast), + FfiConverterMoqContainerStreamInit.lower(init), + status, + ), moqExceptionErrorHandler, ) { - _MoqJsonSnapshotProducerFinalizer.attach(this, _ptr, detach: this); + _MoqMediaContainerStreamProducerFinalizer.attach(this, _ptr, detach: this); } - factory MoqJsonSnapshotProducer.lift(Pointer ptr) { - return MoqJsonSnapshotProducer._(ptr); + factory MoqMediaContainerStreamProducer.lift(Pointer ptr) { + return MoqMediaContainerStreamProducer._(ptr); } Pointer uniffiClonePointer() { if (_isDisposed) { throw StateError("Object has already been disposed"); } return rustCall( - (status) => uniffi_moq_ffi_fn_clone_moqjsonsnapshotproducer(_ptr, status), + (status) => + uniffi_moq_ffi_fn_clone_moqmediacontainerstreamproducer(_ptr, status), ); } @@ -6419,109 +9022,117 @@ class MoqJsonSnapshotProducer implements MoqJsonSnapshotProducerInterface { return; } _isDisposed = true; - _MoqJsonSnapshotProducerFinalizer.detach(this); + _MoqMediaContainerStreamProducerFinalizer.detach(this); rustCall( - (status) => uniffi_moq_ffi_fn_free_moqjsonsnapshotproducer(_ptr, status), - ); - } - - MoqTrackDemand demand() { - return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqjsonsnapshotproducer_demand( - uniffiClonePointer(), - status, - ), - FfiConverterMoqTrackDemand.lift, - moqExceptionErrorHandler, + (status) => + uniffi_moq_ffi_fn_free_moqmediacontainerstreamproducer(_ptr, status), ); } void finish() { return rustCall((status) { - uniffi_moq_ffi_fn_method_moqjsonsnapshotproducer_finish( + uniffi_moq_ffi_fn_method_moqmediacontainerstreamproducer_finish( uniffiClonePointer(), status, ); }, moqExceptionErrorHandler); } - void update({required String value, int? timestampUs = null}) { + void write({required Uint8List payload}) { return rustCall((status) { - uniffi_moq_ffi_fn_method_moqjsonsnapshotproducer_update( + uniffi_moq_ffi_fn_method_moqmediacontainerstreamproducer_write( uniffiClonePointer(), - FfiConverterString.lower(value), - FfiConverterOptionalUInt64.lower(timestampUs), + FfiConverterUint8List.lower(payload), status, ); }, moqExceptionErrorHandler); } } -class FfiConverterMoqJsonSnapshotProducer { - static MoqJsonSnapshotProducer lift(Pointer ptr) { - return MoqJsonSnapshotProducer.lift(ptr); +class FfiConverterMoqMediaContainerStreamProducer { + static MoqMediaContainerStreamProducer lift(Pointer ptr) { + return MoqMediaContainerStreamProducer.lift(ptr); } - static Pointer lower(MoqJsonSnapshotProducer value) { + static Pointer lower(MoqMediaContainerStreamProducer value) { return value.uniffiClonePointer(); } - static int allocationSize(MoqJsonSnapshotProducer value) { + static int allocationSize(MoqMediaContainerStreamProducer value) { return 8; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); final pointer = Pointer.fromAddress(handle); - return LiftRetVal(MoqJsonSnapshotProducer.lift(pointer), 8); + return LiftRetVal(MoqMediaContainerStreamProducer.lift(pointer), 8); } - static int write(MoqJsonSnapshotProducer value, Uint8List buf) { + static int write(MoqMediaContainerStreamProducer value, Uint8List buf) { final handle = lower(value); buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); return 8; } } -abstract class MoqJsonStreamConsumerInterface { +abstract class MoqMediaGroupConsumerInterface { void cancel(); - Future next(); + Future next(); + int sequence(); } -final _MoqJsonStreamConsumerFinalizer = Finalizer>((ptr) { +final _MoqMediaGroupConsumerFinalizer = Finalizer>((ptr) { rustCall( - (status) => uniffi_moq_ffi_fn_free_moqjsonstreamconsumer(ptr, status), + (status) => uniffi_moq_ffi_fn_free_moqmediagroupconsumer(ptr, status), ); }); -class MoqJsonStreamConsumer implements MoqJsonStreamConsumerInterface { +class MoqMediaGroupConsumer implements MoqMediaGroupConsumerInterface { late final Pointer _ptr; bool _isDisposed = false; - MoqJsonStreamConsumer._(this._ptr) { - _MoqJsonStreamConsumerFinalizer.attach(this, _ptr, detach: this); + MoqMediaGroupConsumer._(this._ptr) { + _MoqMediaGroupConsumerFinalizer.attach(this, _ptr, detach: this); } - MoqJsonStreamConsumer({ - required MoqTrackConsumer track, - required MoqJsonStreamConfig config, + MoqMediaGroupConsumer({ + required MoqGroupConsumer group, + required MoqContainer container, }) : _ptr = rustCall( - (status) => uniffi_moq_ffi_fn_constructor_moqjsonstreamconsumer_new( - FfiConverterMoqTrackConsumer.lower(track), - FfiConverterMoqJsonStreamConfig.lower(config), + (status) => uniffi_moq_ffi_fn_constructor_moqmediagroupconsumer_new( + FfiConverterMoqGroupConsumer.lower(group), + FfiConverterMoqContainer.lower(container), status, ), moqExceptionErrorHandler, ) { - _MoqJsonStreamConsumerFinalizer.attach(this, _ptr, detach: this); + _MoqMediaGroupConsumerFinalizer.attach(this, _ptr, detach: this); } - factory MoqJsonStreamConsumer.lift(Pointer ptr) { - return MoqJsonStreamConsumer._(ptr); + static Future fetch({ + required MoqBroadcastConsumer broadcast, + required MoqMediaGroupConfig config, + }) { + return uniffiRustCallAsync( + () => uniffi_moq_ffi_fn_constructor_moqmediagroupconsumer_fetch( + FfiConverterMoqBroadcastConsumer.lower(broadcast), + FfiConverterMoqMediaGroupConfig.lower(config), + ), + ffi_moq_ffi_rust_future_poll_u64, + ffi_moq_ffi_rust_future_complete_u64, + ffi_moq_ffi_rust_future_free_u64, + (int handle) => + MoqMediaGroupConsumer._(Pointer.fromAddress(handle)), + moqExceptionErrorHandler, + ); + } + + factory MoqMediaGroupConsumer.lift(Pointer ptr) { + return MoqMediaGroupConsumer._(ptr); } Pointer uniffiClonePointer() { if (_isDisposed) { throw StateError("Object has already been disposed"); } return rustCall( - (status) => uniffi_moq_ffi_fn_clone_moqjsonstreamconsumer(_ptr, status), + (status) => uniffi_moq_ffi_fn_clone_moqmediagroupconsumer(_ptr, status), ); } @@ -6530,103 +9141,103 @@ class MoqJsonStreamConsumer implements MoqJsonStreamConsumerInterface { return; } _isDisposed = true; - _MoqJsonStreamConsumerFinalizer.detach(this); + _MoqMediaGroupConsumerFinalizer.detach(this); rustCall( - (status) => uniffi_moq_ffi_fn_free_moqjsonstreamconsumer(_ptr, status), + (status) => uniffi_moq_ffi_fn_free_moqmediagroupconsumer(_ptr, status), ); } void cancel() { return rustCall((status) { - uniffi_moq_ffi_fn_method_moqjsonstreamconsumer_cancel( + uniffi_moq_ffi_fn_method_moqmediagroupconsumer_cancel( uniffiClonePointer(), status, ); }, null); } - Future next() { + Future next() { return uniffiRustCallAsync( - () => uniffi_moq_ffi_fn_method_moqjsonstreamconsumer_next( + () => uniffi_moq_ffi_fn_method_moqmediagroupconsumer_next( uniffiClonePointer(), ), ffi_moq_ffi_rust_future_poll_rust_buffer, ffi_moq_ffi_rust_future_complete_rust_buffer, ffi_moq_ffi_rust_future_free_rust_buffer, - FfiConverterOptionalString.lift, + FfiConverterOptionalMoqMediaFrame.lift, moqExceptionErrorHandler, ); } + + int sequence() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqmediagroupconsumer_sequence( + uniffiClonePointer(), + status, + ), + FfiConverterUInt64.lift, + null, + ); + } } -class FfiConverterMoqJsonStreamConsumer { - static MoqJsonStreamConsumer lift(Pointer ptr) { - return MoqJsonStreamConsumer.lift(ptr); +class FfiConverterMoqMediaGroupConsumer { + static MoqMediaGroupConsumer lift(Pointer ptr) { + return MoqMediaGroupConsumer.lift(ptr); } - static Pointer lower(MoqJsonStreamConsumer value) { + static Pointer lower(MoqMediaGroupConsumer value) { return value.uniffiClonePointer(); } - static int allocationSize(MoqJsonStreamConsumer value) { + static int allocationSize(MoqMediaGroupConsumer value) { return 8; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); final pointer = Pointer.fromAddress(handle); - return LiftRetVal(MoqJsonStreamConsumer.lift(pointer), 8); + return LiftRetVal(MoqMediaGroupConsumer.lift(pointer), 8); } - static int write(MoqJsonStreamConsumer value, Uint8List buf) { + static int write(MoqMediaGroupConsumer value, Uint8List buf) { final handle = lower(value); buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); return 8; } } -abstract class MoqJsonStreamProducerInterface { - void append({required String value, int? timestampUs = null}); - MoqTrackDemand demand(); - void finish(); -} +abstract class MoqMediaTimebaseInterface {} -final _MoqJsonStreamProducerFinalizer = Finalizer>((ptr) { - rustCall( - (status) => uniffi_moq_ffi_fn_free_moqjsonstreamproducer(ptr, status), - ); +final _MoqMediaTimebaseFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_moq_ffi_fn_free_moqmediatimebase(ptr, status)); }); -class MoqJsonStreamProducer implements MoqJsonStreamProducerInterface { +class MoqMediaTimebase implements MoqMediaTimebaseInterface { late final Pointer _ptr; bool _isDisposed = false; - MoqJsonStreamProducer._(this._ptr) { - _MoqJsonStreamProducerFinalizer.attach(this, _ptr, detach: this); + MoqMediaTimebase._(this._ptr) { + _MoqMediaTimebaseFinalizer.attach(this, _ptr, detach: this); } - MoqJsonStreamProducer({ - required MoqBroadcastProducer broadcast, - required MoqTrackProducer track, - required MoqJsonStreamConfig config, - }) : _ptr = rustCall( - (status) => uniffi_moq_ffi_fn_constructor_moqjsonstreamproducer_new( - FfiConverterMoqBroadcastProducer.lower(broadcast), - FfiConverterMoqTrackProducer.lower(track), - FfiConverterMoqJsonStreamConfig.lower(config), - status, - ), - moqExceptionErrorHandler, - ) { - _MoqJsonStreamProducerFinalizer.attach(this, _ptr, detach: this); + MoqMediaTimebase({required MoqBroadcastProducer broadcast}) + : _ptr = rustCall( + (status) => uniffi_moq_ffi_fn_constructor_moqmediatimebase_new( + FfiConverterMoqBroadcastProducer.lower(broadcast), + status, + ), + moqExceptionErrorHandler, + ) { + _MoqMediaTimebaseFinalizer.attach(this, _ptr, detach: this); } - factory MoqJsonStreamProducer.lift(Pointer ptr) { - return MoqJsonStreamProducer._(ptr); + factory MoqMediaTimebase.lift(Pointer ptr) { + return MoqMediaTimebase._(ptr); } Pointer uniffiClonePointer() { if (_isDisposed) { throw StateError("Object has already been disposed"); } return rustCall( - (status) => uniffi_moq_ffi_fn_clone_moqjsonstreamproducer(_ptr, status), + (status) => uniffi_moq_ffi_fn_clone_moqmediatimebase(_ptr, status), ); } @@ -6635,112 +9246,81 @@ class MoqJsonStreamProducer implements MoqJsonStreamProducerInterface { return; } _isDisposed = true; - _MoqJsonStreamProducerFinalizer.detach(this); - rustCall( - (status) => uniffi_moq_ffi_fn_free_moqjsonstreamproducer(_ptr, status), - ); - } - - void append({required String value, int? timestampUs = null}) { - return rustCall((status) { - uniffi_moq_ffi_fn_method_moqjsonstreamproducer_append( - uniffiClonePointer(), - FfiConverterString.lower(value), - FfiConverterOptionalUInt64.lower(timestampUs), - status, - ); - }, moqExceptionErrorHandler); - } - - MoqTrackDemand demand() { - return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqjsonstreamproducer_demand( - uniffiClonePointer(), - status, - ), - FfiConverterMoqTrackDemand.lift, - moqExceptionErrorHandler, - ); - } - - void finish() { - return rustCall((status) { - uniffi_moq_ffi_fn_method_moqjsonstreamproducer_finish( - uniffiClonePointer(), - status, - ); - }, moqExceptionErrorHandler); + _MoqMediaTimebaseFinalizer.detach(this); + rustCall((status) => uniffi_moq_ffi_fn_free_moqmediatimebase(_ptr, status)); } } -class FfiConverterMoqJsonStreamProducer { - static MoqJsonStreamProducer lift(Pointer ptr) { - return MoqJsonStreamProducer.lift(ptr); +class FfiConverterMoqMediaTimebase { + static MoqMediaTimebase lift(Pointer ptr) { + return MoqMediaTimebase.lift(ptr); } - static Pointer lower(MoqJsonStreamProducer value) { + static Pointer lower(MoqMediaTimebase value) { return value.uniffiClonePointer(); } - static int allocationSize(MoqJsonStreamProducer value) { + static int allocationSize(MoqMediaTimebase value) { return 8; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); final pointer = Pointer.fromAddress(handle); - return LiftRetVal(MoqJsonStreamProducer.lift(pointer), 8); + return LiftRetVal(MoqMediaTimebase.lift(pointer), 8); } - static int write(MoqJsonStreamProducer value, Uint8List buf) { + static int write(MoqMediaTimebase value, Uint8List buf) { final handle = lower(value); buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); return 8; } } -abstract class MoqMediaCatalogConsumerInterface { +abstract class MoqMediaTrackConsumerInterface { void cancel(); - Future next(); + Future next(); } -final _MoqMediaCatalogConsumerFinalizer = Finalizer>((ptr) { +final _MoqMediaTrackConsumerFinalizer = Finalizer>((ptr) { rustCall( - (status) => uniffi_moq_ffi_fn_free_moqmediacatalogconsumer(ptr, status), + (status) => uniffi_moq_ffi_fn_free_moqmediatrackconsumer(ptr, status), ); }); -class MoqMediaCatalogConsumer implements MoqMediaCatalogConsumerInterface { +class MoqMediaTrackConsumer implements MoqMediaTrackConsumerInterface { late final Pointer _ptr; bool _isDisposed = false; - MoqMediaCatalogConsumer._(this._ptr) { - _MoqMediaCatalogConsumerFinalizer.attach(this, _ptr, detach: this); + MoqMediaTrackConsumer._(this._ptr) { + _MoqMediaTrackConsumerFinalizer.attach(this, _ptr, detach: this); } - static Future subscribe({ + static Future subscribe({ required MoqBroadcastConsumer broadcast, + required MoqMediaTrackConfig config, }) { return uniffiRustCallAsync( - () => uniffi_moq_ffi_fn_constructor_moqmediacatalogconsumer_subscribe( + () => uniffi_moq_ffi_fn_constructor_moqmediatrackconsumer_subscribe( FfiConverterMoqBroadcastConsumer.lower(broadcast), + FfiConverterMoqMediaTrackConfig.lower(config), ), ffi_moq_ffi_rust_future_poll_u64, ffi_moq_ffi_rust_future_complete_u64, ffi_moq_ffi_rust_future_free_u64, (int handle) => - MoqMediaCatalogConsumer._(Pointer.fromAddress(handle)), + MoqMediaTrackConsumer._(Pointer.fromAddress(handle)), moqExceptionErrorHandler, ); } - factory MoqMediaCatalogConsumer.lift(Pointer ptr) { - return MoqMediaCatalogConsumer._(ptr); + factory MoqMediaTrackConsumer.lift(Pointer ptr) { + return MoqMediaTrackConsumer._(ptr); } Pointer uniffiClonePointer() { if (_isDisposed) { throw StateError("Object has already been disposed"); } return rustCall( - (status) => uniffi_moq_ffi_fn_clone_moqmediacatalogconsumer(_ptr, status), + (status) => uniffi_moq_ffi_fn_clone_moqmediatrackconsumer(_ptr, status), ); } @@ -6749,99 +9329,122 @@ class MoqMediaCatalogConsumer implements MoqMediaCatalogConsumerInterface { return; } _isDisposed = true; - _MoqMediaCatalogConsumerFinalizer.detach(this); + _MoqMediaTrackConsumerFinalizer.detach(this); rustCall( - (status) => uniffi_moq_ffi_fn_free_moqmediacatalogconsumer(_ptr, status), + (status) => uniffi_moq_ffi_fn_free_moqmediatrackconsumer(_ptr, status), ); } void cancel() { return rustCall((status) { - uniffi_moq_ffi_fn_method_moqmediacatalogconsumer_cancel( + uniffi_moq_ffi_fn_method_moqmediatrackconsumer_cancel( uniffiClonePointer(), status, ); }, null); } - Future next() { + Future next() { return uniffiRustCallAsync( - () => uniffi_moq_ffi_fn_method_moqmediacatalogconsumer_next( + () => uniffi_moq_ffi_fn_method_moqmediatrackconsumer_next( uniffiClonePointer(), ), ffi_moq_ffi_rust_future_poll_rust_buffer, ffi_moq_ffi_rust_future_complete_rust_buffer, ffi_moq_ffi_rust_future_free_rust_buffer, - FfiConverterOptionalMoqCatalog.lift, + FfiConverterOptionalMoqMediaFrame.lift, moqExceptionErrorHandler, ); } } -class FfiConverterMoqMediaCatalogConsumer { - static MoqMediaCatalogConsumer lift(Pointer ptr) { - return MoqMediaCatalogConsumer.lift(ptr); +class FfiConverterMoqMediaTrackConsumer { + static MoqMediaTrackConsumer lift(Pointer ptr) { + return MoqMediaTrackConsumer.lift(ptr); } - static Pointer lower(MoqMediaCatalogConsumer value) { + static Pointer lower(MoqMediaTrackConsumer value) { return value.uniffiClonePointer(); } - static int allocationSize(MoqMediaCatalogConsumer value) { + static int allocationSize(MoqMediaTrackConsumer value) { return 8; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); final pointer = Pointer.fromAddress(handle); - return LiftRetVal(MoqMediaCatalogConsumer.lift(pointer), 8); + return LiftRetVal(MoqMediaTrackConsumer.lift(pointer), 8); } - static int write(MoqMediaCatalogConsumer value, Uint8List buf) { + static int write(MoqMediaTrackConsumer value, Uint8List buf) { final handle = lower(value); buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); return 8; } } -abstract class MoqMediaCatalogProducerInterface { - int now(); - void removeSection({required String name}); - void setSection({required String name, required String json}); - void setVideoProperties({required MoqVideoProperties properties}); +abstract class MoqMediaTrackProducerInterface { + void cut(); + MoqTrackDemand demand(); + void discontinuity(); + void finish(); + void flush({required int timestampUs}); + void seek({required int sequence}); + void writeFrame({required MoqFrame frame}); } -final _MoqMediaCatalogProducerFinalizer = Finalizer>((ptr) { +final _MoqMediaTrackProducerFinalizer = Finalizer>((ptr) { rustCall( - (status) => uniffi_moq_ffi_fn_free_moqmediacatalogproducer(ptr, status), + (status) => uniffi_moq_ffi_fn_free_moqmediatrackproducer(ptr, status), ); }); -class MoqMediaCatalogProducer implements MoqMediaCatalogProducerInterface { +class MoqMediaTrackProducer implements MoqMediaTrackProducerInterface { late final Pointer _ptr; bool _isDisposed = false; - MoqMediaCatalogProducer._(this._ptr) { - _MoqMediaCatalogProducerFinalizer.attach(this, _ptr, detach: this); + MoqMediaTrackProducer._(this._ptr) { + _MoqMediaTrackProducerFinalizer.attach(this, _ptr, detach: this); } - MoqMediaCatalogProducer({required MoqBroadcastProducer broadcast}) - : _ptr = rustCall( - (status) => uniffi_moq_ffi_fn_constructor_moqmediacatalogproducer_new( - FfiConverterMoqBroadcastProducer.lower(broadcast), - status, - ), - moqExceptionErrorHandler, - ) { - _MoqMediaCatalogProducerFinalizer.attach(this, _ptr, detach: this); + MoqMediaTrackProducer.audio({ + required MoqBroadcastProducer broadcast, + required MoqMediaTarget target, + required MoqAudioInit init, + }) : _ptr = rustCall( + (status) => uniffi_moq_ffi_fn_constructor_moqmediatrackproducer_audio( + FfiConverterMoqBroadcastProducer.lower(broadcast), + FfiConverterMoqMediaTarget.lower(target), + FfiConverterMoqAudioInit.lower(init), + status, + ), + moqExceptionErrorHandler, + ) { + _MoqMediaTrackProducerFinalizer.attach(this, _ptr, detach: this); } - factory MoqMediaCatalogProducer.lift(Pointer ptr) { - return MoqMediaCatalogProducer._(ptr); + MoqMediaTrackProducer.video({ + required MoqBroadcastProducer broadcast, + required MoqMediaTarget target, + required MoqVideoInit init, + }) : _ptr = rustCall( + (status) => uniffi_moq_ffi_fn_constructor_moqmediatrackproducer_video( + FfiConverterMoqBroadcastProducer.lower(broadcast), + FfiConverterMoqMediaTarget.lower(target), + FfiConverterMoqVideoInit.lower(init), + status, + ), + moqExceptionErrorHandler, + ) { + _MoqMediaTrackProducerFinalizer.attach(this, _ptr, detach: this); + } + factory MoqMediaTrackProducer.lift(Pointer ptr) { + return MoqMediaTrackProducer._(ptr); } Pointer uniffiClonePointer() { if (_isDisposed) { throw StateError("Object has already been disposed"); } return rustCall( - (status) => uniffi_moq_ffi_fn_clone_moqmediacatalogproducer(_ptr, status), + (status) => uniffi_moq_ffi_fn_clone_moqmediatrackproducer(_ptr, status), ); } @@ -6850,116 +9453,144 @@ class MoqMediaCatalogProducer implements MoqMediaCatalogProducerInterface { return; } _isDisposed = true; - _MoqMediaCatalogProducerFinalizer.detach(this); + _MoqMediaTrackProducerFinalizer.detach(this); rustCall( - (status) => uniffi_moq_ffi_fn_free_moqmediacatalogproducer(_ptr, status), + (status) => uniffi_moq_ffi_fn_free_moqmediatrackproducer(_ptr, status), ); } - int now() { + void cut() { + return rustCall((status) { + uniffi_moq_ffi_fn_method_moqmediatrackproducer_cut( + uniffiClonePointer(), + status, + ); + }, moqExceptionErrorHandler); + } + + MoqTrackDemand demand() { return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqmediacatalogproducer_now( + (status) => uniffi_moq_ffi_fn_method_moqmediatrackproducer_demand( uniffiClonePointer(), status, ), - FfiConverterUInt64.lift, + FfiConverterMoqTrackDemand.lift, moqExceptionErrorHandler, ); } - void removeSection({required String name}) { + void discontinuity() { return rustCall((status) { - uniffi_moq_ffi_fn_method_moqmediacatalogproducer_remove_section( + uniffi_moq_ffi_fn_method_moqmediatrackproducer_discontinuity( uniffiClonePointer(), - FfiConverterString.lower(name), status, ); }, moqExceptionErrorHandler); } - void setSection({required String name, required String json}) { + void finish() { return rustCall((status) { - uniffi_moq_ffi_fn_method_moqmediacatalogproducer_set_section( + uniffi_moq_ffi_fn_method_moqmediatrackproducer_finish( uniffiClonePointer(), - FfiConverterString.lower(name), - FfiConverterString.lower(json), status, ); }, moqExceptionErrorHandler); } - void setVideoProperties({required MoqVideoProperties properties}) { + void flush({required int timestampUs}) { return rustCall((status) { - uniffi_moq_ffi_fn_method_moqmediacatalogproducer_set_video_properties( + uniffi_moq_ffi_fn_method_moqmediatrackproducer_flush( uniffiClonePointer(), - FfiConverterMoqVideoProperties.lower(properties), + FfiConverterUInt64.lower(timestampUs), + status, + ); + }, moqExceptionErrorHandler); + } + + void seek({required int sequence}) { + return rustCall((status) { + uniffi_moq_ffi_fn_method_moqmediatrackproducer_seek( + uniffiClonePointer(), + FfiConverterUInt64.lower(sequence), + status, + ); + }, moqExceptionErrorHandler); + } + + void writeFrame({required MoqFrame frame}) { + return rustCall((status) { + uniffi_moq_ffi_fn_method_moqmediatrackproducer_write_frame( + uniffiClonePointer(), + FfiConverterMoqFrame.lower(frame), status, ); }, moqExceptionErrorHandler); } } -class FfiConverterMoqMediaCatalogProducer { - static MoqMediaCatalogProducer lift(Pointer ptr) { - return MoqMediaCatalogProducer.lift(ptr); +class FfiConverterMoqMediaTrackProducer { + static MoqMediaTrackProducer lift(Pointer ptr) { + return MoqMediaTrackProducer.lift(ptr); } - static Pointer lower(MoqMediaCatalogProducer value) { + static Pointer lower(MoqMediaTrackProducer value) { return value.uniffiClonePointer(); } - static int allocationSize(MoqMediaCatalogProducer value) { + static int allocationSize(MoqMediaTrackProducer value) { return 8; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); final pointer = Pointer.fromAddress(handle); - return LiftRetVal(MoqMediaCatalogProducer.lift(pointer), 8); + return LiftRetVal(MoqMediaTrackProducer.lift(pointer), 8); } - static int write(MoqMediaCatalogProducer value, Uint8List buf) { + static int write(MoqMediaTrackProducer value, Uint8List buf) { final handle = lower(value); buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); return 8; } } -abstract class MoqMediaContainerProducerInterface { - void cut(); +abstract class MoqMediaTrackStreamProducerInterface { + MoqTrackDemand demand(); void finish(); - void seek({required int sequence}); void write({required Uint8List payload}); } -final _MoqMediaContainerProducerFinalizer = Finalizer>((ptr) { +final _MoqMediaTrackStreamProducerFinalizer = Finalizer>((ptr) { rustCall( - (status) => uniffi_moq_ffi_fn_free_moqmediacontainerproducer(ptr, status), + (status) => uniffi_moq_ffi_fn_free_moqmediatrackstreamproducer(ptr, status), ); }); -class MoqMediaContainerProducer implements MoqMediaContainerProducerInterface { +class MoqMediaTrackStreamProducer + implements MoqMediaTrackStreamProducerInterface { late final Pointer _ptr; bool _isDisposed = false; - MoqMediaContainerProducer._(this._ptr) { - _MoqMediaContainerProducerFinalizer.attach(this, _ptr, detach: this); + MoqMediaTrackStreamProducer._(this._ptr) { + _MoqMediaTrackStreamProducerFinalizer.attach(this, _ptr, detach: this); } - MoqMediaContainerProducer({ + MoqMediaTrackStreamProducer.video({ required MoqBroadcastProducer broadcast, - required MoqContainerInit init, + required MoqMediaTarget target, + required MoqVideoInit init, }) : _ptr = rustCall( (status) => - uniffi_moq_ffi_fn_constructor_moqmediacontainerproducer_new( + uniffi_moq_ffi_fn_constructor_moqmediatrackstreamproducer_video( FfiConverterMoqBroadcastProducer.lower(broadcast), - FfiConverterMoqContainerInit.lower(init), + FfiConverterMoqMediaTarget.lower(target), + FfiConverterMoqVideoInit.lower(init), status, ), moqExceptionErrorHandler, ) { - _MoqMediaContainerProducerFinalizer.attach(this, _ptr, detach: this); + _MoqMediaTrackStreamProducerFinalizer.attach(this, _ptr, detach: this); } - factory MoqMediaContainerProducer.lift(Pointer ptr) { - return MoqMediaContainerProducer._(ptr); + factory MoqMediaTrackStreamProducer.lift(Pointer ptr) { + return MoqMediaTrackStreamProducer._(ptr); } Pointer uniffiClonePointer() { if (_isDisposed) { @@ -6967,7 +9598,7 @@ class MoqMediaContainerProducer implements MoqMediaContainerProducerInterface { } return rustCall( (status) => - uniffi_moq_ffi_fn_clone_moqmediacontainerproducer(_ptr, status), + uniffi_moq_ffi_fn_clone_moqmediatrackstreamproducer(_ptr, status), ); } @@ -6976,36 +9607,28 @@ class MoqMediaContainerProducer implements MoqMediaContainerProducerInterface { return; } _isDisposed = true; - _MoqMediaContainerProducerFinalizer.detach(this); + _MoqMediaTrackStreamProducerFinalizer.detach(this); rustCall( (status) => - uniffi_moq_ffi_fn_free_moqmediacontainerproducer(_ptr, status), + uniffi_moq_ffi_fn_free_moqmediatrackstreamproducer(_ptr, status), ); } - void cut() { - return rustCall((status) { - uniffi_moq_ffi_fn_method_moqmediacontainerproducer_cut( + MoqTrackDemand demand() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqmediatrackstreamproducer_demand( uniffiClonePointer(), status, - ); - }, moqExceptionErrorHandler); + ), + FfiConverterMoqTrackDemand.lift, + moqExceptionErrorHandler, + ); } void finish() { return rustCall((status) { - uniffi_moq_ffi_fn_method_moqmediacontainerproducer_finish( - uniffiClonePointer(), - status, - ); - }, moqExceptionErrorHandler); - } - - void seek({required int sequence}) { - return rustCall((status) { - uniffi_moq_ffi_fn_method_moqmediacontainerproducer_seek( + uniffi_moq_ffi_fn_method_moqmediatrackstreamproducer_finish( uniffiClonePointer(), - FfiConverterUInt64.lower(sequence), status, ); }, moqExceptionErrorHandler); @@ -7013,7 +9636,7 @@ class MoqMediaContainerProducer implements MoqMediaContainerProducerInterface { void write({required Uint8List payload}) { return rustCall((status) { - uniffi_moq_ffi_fn_method_moqmediacontainerproducer_write( + uniffi_moq_ffi_fn_method_moqmediatrackstreamproducer_write( uniffiClonePointer(), FfiConverterUint8List.lower(payload), status, @@ -7022,77 +9645,56 @@ class MoqMediaContainerProducer implements MoqMediaContainerProducerInterface { } } -class FfiConverterMoqMediaContainerProducer { - static MoqMediaContainerProducer lift(Pointer ptr) { - return MoqMediaContainerProducer.lift(ptr); +class FfiConverterMoqMediaTrackStreamProducer { + static MoqMediaTrackStreamProducer lift(Pointer ptr) { + return MoqMediaTrackStreamProducer.lift(ptr); } - static Pointer lower(MoqMediaContainerProducer value) { + static Pointer lower(MoqMediaTrackStreamProducer value) { return value.uniffiClonePointer(); } - static int allocationSize(MoqMediaContainerProducer value) { + static int allocationSize(MoqMediaTrackStreamProducer value) { return 8; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); final pointer = Pointer.fromAddress(handle); - return LiftRetVal(MoqMediaContainerProducer.lift(pointer), 8); + return LiftRetVal(MoqMediaTrackStreamProducer.lift(pointer), 8); } - static int write(MoqMediaContainerProducer value, Uint8List buf) { + static int write(MoqMediaTrackStreamProducer value, Uint8List buf) { final handle = lower(value); buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); return 8; } } -abstract class MoqMediaContainerStreamProducerInterface { - void finish(); - void write({required Uint8List payload}); +abstract class MoqAnnounceConsumerInterface { + void cancel(); + Future next(); } -final _MoqMediaContainerStreamProducerFinalizer = Finalizer>(( - ptr, -) { - rustCall( - (status) => - uniffi_moq_ffi_fn_free_moqmediacontainerstreamproducer(ptr, status), - ); +final _MoqAnnounceConsumerFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_moq_ffi_fn_free_moqannounceconsumer(ptr, status)); }); -class MoqMediaContainerStreamProducer - implements MoqMediaContainerStreamProducerInterface { +class MoqAnnounceConsumer implements MoqAnnounceConsumerInterface { late final Pointer _ptr; bool _isDisposed = false; - MoqMediaContainerStreamProducer._(this._ptr) { - _MoqMediaContainerStreamProducerFinalizer.attach(this, _ptr, detach: this); - } - MoqMediaContainerStreamProducer({ - required MoqBroadcastProducer broadcast, - required MoqContainerStreamInit init, - }) : _ptr = rustCall( - (status) => - uniffi_moq_ffi_fn_constructor_moqmediacontainerstreamproducer_new( - FfiConverterMoqBroadcastProducer.lower(broadcast), - FfiConverterMoqContainerStreamInit.lower(init), - status, - ), - moqExceptionErrorHandler, - ) { - _MoqMediaContainerStreamProducerFinalizer.attach(this, _ptr, detach: this); + MoqAnnounceConsumer._(this._ptr) { + _MoqAnnounceConsumerFinalizer.attach(this, _ptr, detach: this); } - factory MoqMediaContainerStreamProducer.lift(Pointer ptr) { - return MoqMediaContainerStreamProducer._(ptr); + factory MoqAnnounceConsumer.lift(Pointer ptr) { + return MoqAnnounceConsumer._(ptr); } Pointer uniffiClonePointer() { if (_isDisposed) { throw StateError("Object has already been disposed"); } return rustCall( - (status) => - uniffi_moq_ffi_fn_clone_moqmediacontainerstreamproducer(_ptr, status), + (status) => uniffi_moq_ffi_fn_clone_moqannounceconsumer(_ptr, status), ); } @@ -7101,117 +9703,87 @@ class MoqMediaContainerStreamProducer return; } _isDisposed = true; - _MoqMediaContainerStreamProducerFinalizer.detach(this); + _MoqAnnounceConsumerFinalizer.detach(this); rustCall( - (status) => - uniffi_moq_ffi_fn_free_moqmediacontainerstreamproducer(_ptr, status), + (status) => uniffi_moq_ffi_fn_free_moqannounceconsumer(_ptr, status), ); } - void finish() { + void cancel() { return rustCall((status) { - uniffi_moq_ffi_fn_method_moqmediacontainerstreamproducer_finish( + uniffi_moq_ffi_fn_method_moqannounceconsumer_cancel( uniffiClonePointer(), status, ); - }, moqExceptionErrorHandler); + }, null); } - void write({required Uint8List payload}) { - return rustCall((status) { - uniffi_moq_ffi_fn_method_moqmediacontainerstreamproducer_write( + Future next() { + return uniffiRustCallAsync( + () => uniffi_moq_ffi_fn_method_moqannounceconsumer_next( uniffiClonePointer(), - FfiConverterUint8List.lower(payload), - status, - ); - }, moqExceptionErrorHandler); + ), + ffi_moq_ffi_rust_future_poll_rust_buffer, + ffi_moq_ffi_rust_future_complete_rust_buffer, + ffi_moq_ffi_rust_future_free_rust_buffer, + FfiConverterOptionalMoqAnnounceEvent.lift, + moqExceptionErrorHandler, + ); } } -class FfiConverterMoqMediaContainerStreamProducer { - static MoqMediaContainerStreamProducer lift(Pointer ptr) { - return MoqMediaContainerStreamProducer.lift(ptr); +class FfiConverterMoqAnnounceConsumer { + static MoqAnnounceConsumer lift(Pointer ptr) { + return MoqAnnounceConsumer.lift(ptr); } - static Pointer lower(MoqMediaContainerStreamProducer value) { + static Pointer lower(MoqAnnounceConsumer value) { return value.uniffiClonePointer(); } - static int allocationSize(MoqMediaContainerStreamProducer value) { + static int allocationSize(MoqAnnounceConsumer value) { return 8; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); final pointer = Pointer.fromAddress(handle); - return LiftRetVal(MoqMediaContainerStreamProducer.lift(pointer), 8); + return LiftRetVal(MoqAnnounceConsumer.lift(pointer), 8); } - static int write(MoqMediaContainerStreamProducer value, Uint8List buf) { + static int write(MoqAnnounceConsumer value, Uint8List buf) { final handle = lower(value); buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); return 8; } } -abstract class MoqMediaGroupConsumerInterface { +abstract class MoqAnnouncedBroadcastInterface { + Future available(); void cancel(); - Future next(); - int sequence(); } -final _MoqMediaGroupConsumerFinalizer = Finalizer>((ptr) { +final _MoqAnnouncedBroadcastFinalizer = Finalizer>((ptr) { rustCall( - (status) => uniffi_moq_ffi_fn_free_moqmediagroupconsumer(ptr, status), + (status) => uniffi_moq_ffi_fn_free_moqannouncedbroadcast(ptr, status), ); }); -class MoqMediaGroupConsumer implements MoqMediaGroupConsumerInterface { +class MoqAnnouncedBroadcast implements MoqAnnouncedBroadcastInterface { late final Pointer _ptr; bool _isDisposed = false; - MoqMediaGroupConsumer._(this._ptr) { - _MoqMediaGroupConsumerFinalizer.attach(this, _ptr, detach: this); - } - MoqMediaGroupConsumer({ - required MoqGroupConsumer group, - required MoqContainer container, - }) : _ptr = rustCall( - (status) => uniffi_moq_ffi_fn_constructor_moqmediagroupconsumer_new( - FfiConverterMoqGroupConsumer.lower(group), - FfiConverterMoqContainer.lower(container), - status, - ), - moqExceptionErrorHandler, - ) { - _MoqMediaGroupConsumerFinalizer.attach(this, _ptr, detach: this); - } - static Future fetch({ - required MoqBroadcastConsumer broadcast, - required MoqMediaGroupConfig config, - }) { - return uniffiRustCallAsync( - () => uniffi_moq_ffi_fn_constructor_moqmediagroupconsumer_fetch( - FfiConverterMoqBroadcastConsumer.lower(broadcast), - FfiConverterMoqMediaGroupConfig.lower(config), - ), - ffi_moq_ffi_rust_future_poll_u64, - ffi_moq_ffi_rust_future_complete_u64, - ffi_moq_ffi_rust_future_free_u64, - (int handle) => - MoqMediaGroupConsumer._(Pointer.fromAddress(handle)), - moqExceptionErrorHandler, - ); + MoqAnnouncedBroadcast._(this._ptr) { + _MoqAnnouncedBroadcastFinalizer.attach(this, _ptr, detach: this); } - - factory MoqMediaGroupConsumer.lift(Pointer ptr) { - return MoqMediaGroupConsumer._(ptr); + factory MoqAnnouncedBroadcast.lift(Pointer ptr) { + return MoqAnnouncedBroadcast._(ptr); } Pointer uniffiClonePointer() { if (_isDisposed) { throw StateError("Object has already been disposed"); } return rustCall( - (status) => uniffi_moq_ffi_fn_clone_moqmediagroupconsumer(_ptr, status), + (status) => uniffi_moq_ffi_fn_clone_moqannouncedbroadcast(_ptr, status), ); } @@ -7220,103 +9792,87 @@ class MoqMediaGroupConsumer implements MoqMediaGroupConsumerInterface { return; } _isDisposed = true; - _MoqMediaGroupConsumerFinalizer.detach(this); + _MoqAnnouncedBroadcastFinalizer.detach(this); rustCall( - (status) => uniffi_moq_ffi_fn_free_moqmediagroupconsumer(_ptr, status), + (status) => uniffi_moq_ffi_fn_free_moqannouncedbroadcast(_ptr, status), ); } - void cancel() { - return rustCall((status) { - uniffi_moq_ffi_fn_method_moqmediagroupconsumer_cancel( - uniffiClonePointer(), - status, - ); - }, null); - } - - Future next() { + Future available() { return uniffiRustCallAsync( - () => uniffi_moq_ffi_fn_method_moqmediagroupconsumer_next( + () => uniffi_moq_ffi_fn_method_moqannouncedbroadcast_available( uniffiClonePointer(), ), - ffi_moq_ffi_rust_future_poll_rust_buffer, - ffi_moq_ffi_rust_future_complete_rust_buffer, - ffi_moq_ffi_rust_future_free_rust_buffer, - FfiConverterOptionalMoqMediaFrame.lift, + ffi_moq_ffi_rust_future_poll_u64, + ffi_moq_ffi_rust_future_complete_u64, + ffi_moq_ffi_rust_future_free_u64, + (ptr) => + FfiConverterMoqBroadcastConsumer.lift(Pointer.fromAddress(ptr)), moqExceptionErrorHandler, ); } - int sequence() { - return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqmediagroupconsumer_sequence( + void cancel() { + return rustCall((status) { + uniffi_moq_ffi_fn_method_moqannouncedbroadcast_cancel( uniffiClonePointer(), status, - ), - FfiConverterUInt64.lift, - null, - ); + ); + }, null); } } - -class FfiConverterMoqMediaGroupConsumer { - static MoqMediaGroupConsumer lift(Pointer ptr) { - return MoqMediaGroupConsumer.lift(ptr); + +class FfiConverterMoqAnnouncedBroadcast { + static MoqAnnouncedBroadcast lift(Pointer ptr) { + return MoqAnnouncedBroadcast.lift(ptr); } - static Pointer lower(MoqMediaGroupConsumer value) { + static Pointer lower(MoqAnnouncedBroadcast value) { return value.uniffiClonePointer(); } - static int allocationSize(MoqMediaGroupConsumer value) { + static int allocationSize(MoqAnnouncedBroadcast value) { return 8; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); final pointer = Pointer.fromAddress(handle); - return LiftRetVal(MoqMediaGroupConsumer.lift(pointer), 8); + return LiftRetVal(MoqAnnouncedBroadcast.lift(pointer), 8); } - static int write(MoqMediaGroupConsumer value, Uint8List buf) { + static int write(MoqAnnouncedBroadcast value, Uint8List buf) { final handle = lower(value); buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); return 8; } } -abstract class MoqMediaTimebaseInterface {} +abstract class MoqBroadcastRequestInterface { + void accept({required MoqBroadcastProducer broadcast}); + String path(); + void reject({required int errorCode}); +} -final _MoqMediaTimebaseFinalizer = Finalizer>((ptr) { - rustCall((status) => uniffi_moq_ffi_fn_free_moqmediatimebase(ptr, status)); +final _MoqBroadcastRequestFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_moq_ffi_fn_free_moqbroadcastrequest(ptr, status)); }); -class MoqMediaTimebase implements MoqMediaTimebaseInterface { +class MoqBroadcastRequest implements MoqBroadcastRequestInterface { late final Pointer _ptr; bool _isDisposed = false; - MoqMediaTimebase._(this._ptr) { - _MoqMediaTimebaseFinalizer.attach(this, _ptr, detach: this); - } - MoqMediaTimebase({required MoqBroadcastProducer broadcast}) - : _ptr = rustCall( - (status) => uniffi_moq_ffi_fn_constructor_moqmediatimebase_new( - FfiConverterMoqBroadcastProducer.lower(broadcast), - status, - ), - moqExceptionErrorHandler, - ) { - _MoqMediaTimebaseFinalizer.attach(this, _ptr, detach: this); + MoqBroadcastRequest._(this._ptr) { + _MoqBroadcastRequestFinalizer.attach(this, _ptr, detach: this); } - factory MoqMediaTimebase.lift(Pointer ptr) { - return MoqMediaTimebase._(ptr); + factory MoqBroadcastRequest.lift(Pointer ptr) { + return MoqBroadcastRequest._(ptr); } Pointer uniffiClonePointer() { if (_isDisposed) { throw StateError("Object has already been disposed"); } return rustCall( - (status) => uniffi_moq_ffi_fn_clone_moqmediatimebase(_ptr, status), + (status) => uniffi_moq_ffi_fn_clone_moqbroadcastrequest(_ptr, status), ); } @@ -7325,81 +9881,95 @@ class MoqMediaTimebase implements MoqMediaTimebaseInterface { return; } _isDisposed = true; - _MoqMediaTimebaseFinalizer.detach(this); - rustCall((status) => uniffi_moq_ffi_fn_free_moqmediatimebase(_ptr, status)); + _MoqBroadcastRequestFinalizer.detach(this); + rustCall( + (status) => uniffi_moq_ffi_fn_free_moqbroadcastrequest(_ptr, status), + ); + } + + void accept({required MoqBroadcastProducer broadcast}) { + return rustCall((status) { + uniffi_moq_ffi_fn_method_moqbroadcastrequest_accept( + uniffiClonePointer(), + FfiConverterMoqBroadcastProducer.lower(broadcast), + status, + ); + }, moqExceptionErrorHandler); + } + + String path() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqbroadcastrequest_path( + uniffiClonePointer(), + status, + ), + FfiConverterString.lift, + moqExceptionErrorHandler, + ); + } + + void reject({required int errorCode}) { + return rustCall((status) { + uniffi_moq_ffi_fn_method_moqbroadcastrequest_reject( + uniffiClonePointer(), + FfiConverterUInt16.lower(errorCode), + status, + ); + }, moqExceptionErrorHandler); } } -class FfiConverterMoqMediaTimebase { - static MoqMediaTimebase lift(Pointer ptr) { - return MoqMediaTimebase.lift(ptr); +class FfiConverterMoqBroadcastRequest { + static MoqBroadcastRequest lift(Pointer ptr) { + return MoqBroadcastRequest.lift(ptr); } - static Pointer lower(MoqMediaTimebase value) { + static Pointer lower(MoqBroadcastRequest value) { return value.uniffiClonePointer(); } - static int allocationSize(MoqMediaTimebase value) { + static int allocationSize(MoqBroadcastRequest value) { return 8; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); final pointer = Pointer.fromAddress(handle); - return LiftRetVal(MoqMediaTimebase.lift(pointer), 8); + return LiftRetVal(MoqBroadcastRequest.lift(pointer), 8); } - static int write(MoqMediaTimebase value, Uint8List buf) { + static int write(MoqBroadcastRequest value, Uint8List buf) { final handle = lower(value); buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); return 8; } } -abstract class MoqMediaTrackConsumerInterface { - void cancel(); - Future next(); +abstract class MoqOriginConsumerInterface { + MoqAnnounceConsumer announced({required MoqAnnounceConfig config}); + MoqAnnouncedBroadcast announcedBroadcast({required String path}); + Future requestBroadcast({required String path}); } -final _MoqMediaTrackConsumerFinalizer = Finalizer>((ptr) { - rustCall( - (status) => uniffi_moq_ffi_fn_free_moqmediatrackconsumer(ptr, status), - ); +final _MoqOriginConsumerFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_moq_ffi_fn_free_moqoriginconsumer(ptr, status)); }); -class MoqMediaTrackConsumer implements MoqMediaTrackConsumerInterface { +class MoqOriginConsumer implements MoqOriginConsumerInterface { late final Pointer _ptr; bool _isDisposed = false; - MoqMediaTrackConsumer._(this._ptr) { - _MoqMediaTrackConsumerFinalizer.attach(this, _ptr, detach: this); - } - static Future subscribe({ - required MoqBroadcastConsumer broadcast, - required MoqMediaTrackConfig config, - }) { - return uniffiRustCallAsync( - () => uniffi_moq_ffi_fn_constructor_moqmediatrackconsumer_subscribe( - FfiConverterMoqBroadcastConsumer.lower(broadcast), - FfiConverterMoqMediaTrackConfig.lower(config), - ), - ffi_moq_ffi_rust_future_poll_u64, - ffi_moq_ffi_rust_future_complete_u64, - ffi_moq_ffi_rust_future_free_u64, - (int handle) => - MoqMediaTrackConsumer._(Pointer.fromAddress(handle)), - moqExceptionErrorHandler, - ); + MoqOriginConsumer._(this._ptr) { + _MoqOriginConsumerFinalizer.attach(this, _ptr, detach: this); } - - factory MoqMediaTrackConsumer.lift(Pointer ptr) { - return MoqMediaTrackConsumer._(ptr); + factory MoqOriginConsumer.lift(Pointer ptr) { + return MoqOriginConsumer._(ptr); } Pointer uniffiClonePointer() { if (_isDisposed) { throw StateError("Object has already been disposed"); } return rustCall( - (status) => uniffi_moq_ffi_fn_clone_moqmediatrackconsumer(_ptr, status), + (status) => uniffi_moq_ffi_fn_clone_moqoriginconsumer(_ptr, status), ); } @@ -7408,122 +9978,104 @@ class MoqMediaTrackConsumer implements MoqMediaTrackConsumerInterface { return; } _isDisposed = true; - _MoqMediaTrackConsumerFinalizer.detach(this); + _MoqOriginConsumerFinalizer.detach(this); rustCall( - (status) => uniffi_moq_ffi_fn_free_moqmediatrackconsumer(_ptr, status), + (status) => uniffi_moq_ffi_fn_free_moqoriginconsumer(_ptr, status), ); } - void cancel() { - return rustCall((status) { - uniffi_moq_ffi_fn_method_moqmediatrackconsumer_cancel( + MoqAnnounceConsumer announced({required MoqAnnounceConfig config}) { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqoriginconsumer_announced( uniffiClonePointer(), + FfiConverterMoqAnnounceConfig.lower(config), status, - ); - }, null); + ), + FfiConverterMoqAnnounceConsumer.lift, + moqExceptionErrorHandler, + ); } - Future next() { + MoqAnnouncedBroadcast announcedBroadcast({required String path}) { + return rustCallWithLifter( + (status) => + uniffi_moq_ffi_fn_method_moqoriginconsumer_announced_broadcast( + uniffiClonePointer(), + FfiConverterString.lower(path), + status, + ), + FfiConverterMoqAnnouncedBroadcast.lift, + moqExceptionErrorHandler, + ); + } + + Future requestBroadcast({required String path}) { return uniffiRustCallAsync( - () => uniffi_moq_ffi_fn_method_moqmediatrackconsumer_next( + () => uniffi_moq_ffi_fn_method_moqoriginconsumer_request_broadcast( uniffiClonePointer(), + FfiConverterString.lower(path), ), - ffi_moq_ffi_rust_future_poll_rust_buffer, - ffi_moq_ffi_rust_future_complete_rust_buffer, - ffi_moq_ffi_rust_future_free_rust_buffer, - FfiConverterOptionalMoqMediaFrame.lift, + ffi_moq_ffi_rust_future_poll_u64, + ffi_moq_ffi_rust_future_complete_u64, + ffi_moq_ffi_rust_future_free_u64, + (ptr) => + FfiConverterMoqBroadcastConsumer.lift(Pointer.fromAddress(ptr)), moqExceptionErrorHandler, ); } } -class FfiConverterMoqMediaTrackConsumer { - static MoqMediaTrackConsumer lift(Pointer ptr) { - return MoqMediaTrackConsumer.lift(ptr); +class FfiConverterMoqOriginConsumer { + static MoqOriginConsumer lift(Pointer ptr) { + return MoqOriginConsumer.lift(ptr); } - static Pointer lower(MoqMediaTrackConsumer value) { + static Pointer lower(MoqOriginConsumer value) { return value.uniffiClonePointer(); } - static int allocationSize(MoqMediaTrackConsumer value) { + static int allocationSize(MoqOriginConsumer value) { return 8; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); final pointer = Pointer.fromAddress(handle); - return LiftRetVal(MoqMediaTrackConsumer.lift(pointer), 8); + return LiftRetVal(MoqOriginConsumer.lift(pointer), 8); } - static int write(MoqMediaTrackConsumer value, Uint8List buf) { + static int write(MoqOriginConsumer value, Uint8List buf) { final handle = lower(value); buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); return 8; } } -abstract class MoqMediaTrackProducerInterface { - void cut(); - MoqTrackDemand demand(); - void discontinuity(); - void finish(); - void flush({required int timestampUs}); - void seek({required int sequence}); - void writeFrame({required MoqFrame frame}); +abstract class MoqOriginDynamicInterface { + void cancel(); + Future requestedBroadcast(); + void update({required MoqRoute route}); } -final _MoqMediaTrackProducerFinalizer = Finalizer>((ptr) { - rustCall( - (status) => uniffi_moq_ffi_fn_free_moqmediatrackproducer(ptr, status), - ); +final _MoqOriginDynamicFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_moq_ffi_fn_free_moqorigindynamic(ptr, status)); }); - -class MoqMediaTrackProducer implements MoqMediaTrackProducerInterface { - late final Pointer _ptr; - bool _isDisposed = false; - MoqMediaTrackProducer._(this._ptr) { - _MoqMediaTrackProducerFinalizer.attach(this, _ptr, detach: this); - } - MoqMediaTrackProducer.audio({ - required MoqBroadcastProducer broadcast, - required MoqMediaTarget target, - required MoqAudioInit init, - }) : _ptr = rustCall( - (status) => uniffi_moq_ffi_fn_constructor_moqmediatrackproducer_audio( - FfiConverterMoqBroadcastProducer.lower(broadcast), - FfiConverterMoqMediaTarget.lower(target), - FfiConverterMoqAudioInit.lower(init), - status, - ), - moqExceptionErrorHandler, - ) { - _MoqMediaTrackProducerFinalizer.attach(this, _ptr, detach: this); - } - MoqMediaTrackProducer.video({ - required MoqBroadcastProducer broadcast, - required MoqMediaTarget target, - required MoqVideoInit init, - }) : _ptr = rustCall( - (status) => uniffi_moq_ffi_fn_constructor_moqmediatrackproducer_video( - FfiConverterMoqBroadcastProducer.lower(broadcast), - FfiConverterMoqMediaTarget.lower(target), - FfiConverterMoqVideoInit.lower(init), - status, - ), - moqExceptionErrorHandler, - ) { - _MoqMediaTrackProducerFinalizer.attach(this, _ptr, detach: this); + +class MoqOriginDynamic implements MoqOriginDynamicInterface { + late final Pointer _ptr; + bool _isDisposed = false; + MoqOriginDynamic._(this._ptr) { + _MoqOriginDynamicFinalizer.attach(this, _ptr, detach: this); } - factory MoqMediaTrackProducer.lift(Pointer ptr) { - return MoqMediaTrackProducer._(ptr); + factory MoqOriginDynamic.lift(Pointer ptr) { + return MoqOriginDynamic._(ptr); } Pointer uniffiClonePointer() { if (_isDisposed) { throw StateError("Object has already been disposed"); } return rustCall( - (status) => uniffi_moq_ffi_fn_clone_moqmediatrackproducer(_ptr, status), + (status) => uniffi_moq_ffi_fn_clone_moqorigindynamic(_ptr, status), ); } @@ -7532,152 +10084,105 @@ class MoqMediaTrackProducer implements MoqMediaTrackProducerInterface { return; } _isDisposed = true; - _MoqMediaTrackProducerFinalizer.detach(this); - rustCall( - (status) => uniffi_moq_ffi_fn_free_moqmediatrackproducer(_ptr, status), - ); + _MoqOriginDynamicFinalizer.detach(this); + rustCall((status) => uniffi_moq_ffi_fn_free_moqorigindynamic(_ptr, status)); } - void cut() { + void cancel() { return rustCall((status) { - uniffi_moq_ffi_fn_method_moqmediatrackproducer_cut( + uniffi_moq_ffi_fn_method_moqorigindynamic_cancel( uniffiClonePointer(), status, ); - }, moqExceptionErrorHandler); + }, null); } - MoqTrackDemand demand() { - return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqmediatrackproducer_demand( + Future requestedBroadcast() { + return uniffiRustCallAsync( + () => uniffi_moq_ffi_fn_method_moqorigindynamic_requested_broadcast( uniffiClonePointer(), - status, ), - FfiConverterMoqTrackDemand.lift, + ffi_moq_ffi_rust_future_poll_u64, + ffi_moq_ffi_rust_future_complete_u64, + ffi_moq_ffi_rust_future_free_u64, + (ptr) => + FfiConverterMoqBroadcastRequest.lift(Pointer.fromAddress(ptr)), moqExceptionErrorHandler, ); } - void discontinuity() { - return rustCall((status) { - uniffi_moq_ffi_fn_method_moqmediatrackproducer_discontinuity( - uniffiClonePointer(), - status, - ); - }, moqExceptionErrorHandler); - } - - void finish() { - return rustCall((status) { - uniffi_moq_ffi_fn_method_moqmediatrackproducer_finish( - uniffiClonePointer(), - status, - ); - }, moqExceptionErrorHandler); - } - - void flush({required int timestampUs}) { - return rustCall((status) { - uniffi_moq_ffi_fn_method_moqmediatrackproducer_flush( - uniffiClonePointer(), - FfiConverterUInt64.lower(timestampUs), - status, - ); - }, moqExceptionErrorHandler); - } - - void seek({required int sequence}) { - return rustCall((status) { - uniffi_moq_ffi_fn_method_moqmediatrackproducer_seek( - uniffiClonePointer(), - FfiConverterUInt64.lower(sequence), - status, - ); - }, moqExceptionErrorHandler); - } - - void writeFrame({required MoqFrame frame}) { + void update({required MoqRoute route}) { return rustCall((status) { - uniffi_moq_ffi_fn_method_moqmediatrackproducer_write_frame( + uniffi_moq_ffi_fn_method_moqorigindynamic_update( uniffiClonePointer(), - FfiConverterMoqFrame.lower(frame), + FfiConverterMoqRoute.lower(route), status, ); }, moqExceptionErrorHandler); } } -class FfiConverterMoqMediaTrackProducer { - static MoqMediaTrackProducer lift(Pointer ptr) { - return MoqMediaTrackProducer.lift(ptr); +class FfiConverterMoqOriginDynamic { + static MoqOriginDynamic lift(Pointer ptr) { + return MoqOriginDynamic.lift(ptr); } - static Pointer lower(MoqMediaTrackProducer value) { + static Pointer lower(MoqOriginDynamic value) { return value.uniffiClonePointer(); } - static int allocationSize(MoqMediaTrackProducer value) { + static int allocationSize(MoqOriginDynamic value) { return 8; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); final pointer = Pointer.fromAddress(handle); - return LiftRetVal(MoqMediaTrackProducer.lift(pointer), 8); + return LiftRetVal(MoqOriginDynamic.lift(pointer), 8); } - static int write(MoqMediaTrackProducer value, Uint8List buf) { + static int write(MoqOriginDynamic value, Uint8List buf) { final handle = lower(value); buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); return 8; } } -abstract class MoqMediaTrackStreamProducerInterface { - MoqTrackDemand demand(); - void finish(); - void write({required Uint8List payload}); +abstract class MoqOriginProducerInterface { + MoqOriginConsumer consume(); + MoqBroadcastProducer createBroadcast({required String path}); + MoqOriginDynamic dynamic_({required String prefix, required MoqRoute route}); } -final _MoqMediaTrackStreamProducerFinalizer = Finalizer>((ptr) { - rustCall( - (status) => uniffi_moq_ffi_fn_free_moqmediatrackstreamproducer(ptr, status), - ); +final _MoqOriginProducerFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_moq_ffi_fn_free_moqoriginproducer(ptr, status)); }); -class MoqMediaTrackStreamProducer - implements MoqMediaTrackStreamProducerInterface { +class MoqOriginProducer implements MoqOriginProducerInterface { late final Pointer _ptr; bool _isDisposed = false; - MoqMediaTrackStreamProducer._(this._ptr) { - _MoqMediaTrackStreamProducerFinalizer.attach(this, _ptr, detach: this); + MoqOriginProducer._(this._ptr) { + _MoqOriginProducerFinalizer.attach(this, _ptr, detach: this); } - MoqMediaTrackStreamProducer.video({ - required MoqBroadcastProducer broadcast, - required MoqMediaTarget target, - required MoqVideoInit init, - }) : _ptr = rustCall( - (status) => - uniffi_moq_ffi_fn_constructor_moqmediatrackstreamproducer_video( - FfiConverterMoqBroadcastProducer.lower(broadcast), - FfiConverterMoqMediaTarget.lower(target), - FfiConverterMoqVideoInit.lower(init), - status, - ), - moqExceptionErrorHandler, - ) { - _MoqMediaTrackStreamProducerFinalizer.attach(this, _ptr, detach: this); + MoqOriginProducer({required MoqOriginConfig config}) + : _ptr = rustCall( + (status) => uniffi_moq_ffi_fn_constructor_moqoriginproducer_new( + FfiConverterMoqOriginConfig.lower(config), + status, + ), + null, + ) { + _MoqOriginProducerFinalizer.attach(this, _ptr, detach: this); } - factory MoqMediaTrackStreamProducer.lift(Pointer ptr) { - return MoqMediaTrackStreamProducer._(ptr); + factory MoqOriginProducer.lift(Pointer ptr) { + return MoqOriginProducer._(ptr); } Pointer uniffiClonePointer() { if (_isDisposed) { throw StateError("Object has already been disposed"); } return rustCall( - (status) => - uniffi_moq_ffi_fn_clone_moqmediatrackstreamproducer(_ptr, status), + (status) => uniffi_moq_ffi_fn_clone_moqoriginproducer(_ptr, status), ); } @@ -7686,94 +10191,99 @@ class MoqMediaTrackStreamProducer return; } _isDisposed = true; - _MoqMediaTrackStreamProducerFinalizer.detach(this); + _MoqOriginProducerFinalizer.detach(this); rustCall( - (status) => - uniffi_moq_ffi_fn_free_moqmediatrackstreamproducer(_ptr, status), + (status) => uniffi_moq_ffi_fn_free_moqoriginproducer(_ptr, status), ); } - MoqTrackDemand demand() { + MoqOriginConsumer consume() { return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqmediatrackstreamproducer_demand( + (status) => uniffi_moq_ffi_fn_method_moqoriginproducer_consume( uniffiClonePointer(), status, ), - FfiConverterMoqTrackDemand.lift, - moqExceptionErrorHandler, + FfiConverterMoqOriginConsumer.lift, + null, ); } - void finish() { - return rustCall((status) { - uniffi_moq_ffi_fn_method_moqmediatrackstreamproducer_finish( + MoqBroadcastProducer createBroadcast({required String path}) { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqoriginproducer_create_broadcast( uniffiClonePointer(), + FfiConverterString.lower(path), status, - ); - }, moqExceptionErrorHandler); + ), + FfiConverterMoqBroadcastProducer.lift, + moqExceptionErrorHandler, + ); } - void write({required Uint8List payload}) { - return rustCall((status) { - uniffi_moq_ffi_fn_method_moqmediatrackstreamproducer_write( + MoqOriginDynamic dynamic_({required String prefix, required MoqRoute route}) { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqoriginproducer_dynamic( uniffiClonePointer(), - FfiConverterUint8List.lower(payload), + FfiConverterString.lower(prefix), + FfiConverterMoqRoute.lower(route), status, - ); - }, moqExceptionErrorHandler); + ), + FfiConverterMoqOriginDynamic.lift, + moqExceptionErrorHandler, + ); } } -class FfiConverterMoqMediaTrackStreamProducer { - static MoqMediaTrackStreamProducer lift(Pointer ptr) { - return MoqMediaTrackStreamProducer.lift(ptr); +class FfiConverterMoqOriginProducer { + static MoqOriginProducer lift(Pointer ptr) { + return MoqOriginProducer.lift(ptr); } - static Pointer lower(MoqMediaTrackStreamProducer value) { + static Pointer lower(MoqOriginProducer value) { return value.uniffiClonePointer(); } - static int allocationSize(MoqMediaTrackStreamProducer value) { + static int allocationSize(MoqOriginProducer value) { return 8; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); final pointer = Pointer.fromAddress(handle); - return LiftRetVal(MoqMediaTrackStreamProducer.lift(pointer), 8); + return LiftRetVal(MoqOriginProducer.lift(pointer), 8); } - static int write(MoqMediaTrackStreamProducer value, Uint8List buf) { + static int write(MoqOriginProducer value, Uint8List buf) { final handle = lower(value); buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); return 8; } } -abstract class MoqAnnounceConsumerInterface { +abstract class MoqBroadcastDynamicInterface { void cancel(); - Future next(); + Future requestedTrack(); } -final _MoqAnnounceConsumerFinalizer = Finalizer>((ptr) { - rustCall((status) => uniffi_moq_ffi_fn_free_moqannounceconsumer(ptr, status)); +final _MoqBroadcastDynamicFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_moq_ffi_fn_free_moqbroadcastdynamic(ptr, status)); }); -class MoqAnnounceConsumer implements MoqAnnounceConsumerInterface { +class MoqBroadcastDynamic implements MoqBroadcastDynamicInterface { late final Pointer _ptr; bool _isDisposed = false; - MoqAnnounceConsumer._(this._ptr) { - _MoqAnnounceConsumerFinalizer.attach(this, _ptr, detach: this); + MoqBroadcastDynamic._(this._ptr) { + _MoqBroadcastDynamicFinalizer.attach(this, _ptr, detach: this); } - factory MoqAnnounceConsumer.lift(Pointer ptr) { - return MoqAnnounceConsumer._(ptr); + factory MoqBroadcastDynamic.lift(Pointer ptr) { + return MoqBroadcastDynamic._(ptr); } Pointer uniffiClonePointer() { if (_isDisposed) { throw StateError("Object has already been disposed"); } return rustCall( - (status) => uniffi_moq_ffi_fn_clone_moqannounceconsumer(_ptr, status), + (status) => uniffi_moq_ffi_fn_clone_moqbroadcastdynamic(_ptr, status), ); } @@ -7782,87 +10292,102 @@ class MoqAnnounceConsumer implements MoqAnnounceConsumerInterface { return; } _isDisposed = true; - _MoqAnnounceConsumerFinalizer.detach(this); + _MoqBroadcastDynamicFinalizer.detach(this); rustCall( - (status) => uniffi_moq_ffi_fn_free_moqannounceconsumer(_ptr, status), + (status) => uniffi_moq_ffi_fn_free_moqbroadcastdynamic(_ptr, status), ); } void cancel() { return rustCall((status) { - uniffi_moq_ffi_fn_method_moqannounceconsumer_cancel( + uniffi_moq_ffi_fn_method_moqbroadcastdynamic_cancel( uniffiClonePointer(), status, ); }, null); } - Future next() { + Future requestedTrack() { return uniffiRustCallAsync( - () => uniffi_moq_ffi_fn_method_moqannounceconsumer_next( + () => uniffi_moq_ffi_fn_method_moqbroadcastdynamic_requested_track( uniffiClonePointer(), ), - ffi_moq_ffi_rust_future_poll_rust_buffer, - ffi_moq_ffi_rust_future_complete_rust_buffer, - ffi_moq_ffi_rust_future_free_rust_buffer, - FfiConverterOptionalMoqAnnounceEvent.lift, + ffi_moq_ffi_rust_future_poll_u64, + ffi_moq_ffi_rust_future_complete_u64, + ffi_moq_ffi_rust_future_free_u64, + (ptr) => FfiConverterMoqTrackRequest.lift(Pointer.fromAddress(ptr)), moqExceptionErrorHandler, ); } } -class FfiConverterMoqAnnounceConsumer { - static MoqAnnounceConsumer lift(Pointer ptr) { - return MoqAnnounceConsumer.lift(ptr); +class FfiConverterMoqBroadcastDynamic { + static MoqBroadcastDynamic lift(Pointer ptr) { + return MoqBroadcastDynamic.lift(ptr); } - static Pointer lower(MoqAnnounceConsumer value) { + static Pointer lower(MoqBroadcastDynamic value) { return value.uniffiClonePointer(); } - static int allocationSize(MoqAnnounceConsumer value) { + static int allocationSize(MoqBroadcastDynamic value) { return 8; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); final pointer = Pointer.fromAddress(handle); - return LiftRetVal(MoqAnnounceConsumer.lift(pointer), 8); + return LiftRetVal(MoqBroadcastDynamic.lift(pointer), 8); } - static int write(MoqAnnounceConsumer value, Uint8List buf) { + static int write(MoqBroadcastDynamic value, Uint8List buf) { final handle = lower(value); buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); return 8; } } -abstract class MoqAnnouncedBroadcastInterface { - Future available(); - void cancel(); +abstract class MoqBroadcastProducerInterface { + void announce({required MoqRoute route}); + void close(); + MoqBroadcastConsumer consume(); + MoqBroadcastDynamic dynamic_(); + MoqTrackProducer publishTrack({ + required String name, + required MoqTrackInfo? info, + }); + void unannounce(); } -final _MoqAnnouncedBroadcastFinalizer = Finalizer>((ptr) { +final _MoqBroadcastProducerFinalizer = Finalizer>((ptr) { rustCall( - (status) => uniffi_moq_ffi_fn_free_moqannouncedbroadcast(ptr, status), + (status) => uniffi_moq_ffi_fn_free_moqbroadcastproducer(ptr, status), ); }); -class MoqAnnouncedBroadcast implements MoqAnnouncedBroadcastInterface { +class MoqBroadcastProducer implements MoqBroadcastProducerInterface { late final Pointer _ptr; bool _isDisposed = false; - MoqAnnouncedBroadcast._(this._ptr) { - _MoqAnnouncedBroadcastFinalizer.attach(this, _ptr, detach: this); + MoqBroadcastProducer._(this._ptr) { + _MoqBroadcastProducerFinalizer.attach(this, _ptr, detach: this); } - factory MoqAnnouncedBroadcast.lift(Pointer ptr) { - return MoqAnnouncedBroadcast._(ptr); + MoqBroadcastProducer() + : _ptr = rustCall( + (status) => + uniffi_moq_ffi_fn_constructor_moqbroadcastproducer_new(status), + moqExceptionErrorHandler, + ) { + _MoqBroadcastProducerFinalizer.attach(this, _ptr, detach: this); + } + factory MoqBroadcastProducer.lift(Pointer ptr) { + return MoqBroadcastProducer._(ptr); } Pointer uniffiClonePointer() { if (_isDisposed) { throw StateError("Object has already been disposed"); } return rustCall( - (status) => uniffi_moq_ffi_fn_clone_moqannouncedbroadcast(_ptr, status), + (status) => uniffi_moq_ffi_fn_clone_moqbroadcastproducer(_ptr, status), ); } @@ -7871,87 +10396,132 @@ class MoqAnnouncedBroadcast implements MoqAnnouncedBroadcastInterface { return; } _isDisposed = true; - _MoqAnnouncedBroadcastFinalizer.detach(this); + _MoqBroadcastProducerFinalizer.detach(this); rustCall( - (status) => uniffi_moq_ffi_fn_free_moqannouncedbroadcast(_ptr, status), + (status) => uniffi_moq_ffi_fn_free_moqbroadcastproducer(_ptr, status), ); } - Future available() { - return uniffiRustCallAsync( - () => uniffi_moq_ffi_fn_method_moqannouncedbroadcast_available( + void announce({required MoqRoute route}) { + return rustCall((status) { + uniffi_moq_ffi_fn_method_moqbroadcastproducer_announce( + uniffiClonePointer(), + FfiConverterMoqRoute.lower(route), + status, + ); + }, moqExceptionErrorHandler); + } + + void close() { + return rustCall((status) { + uniffi_moq_ffi_fn_method_moqbroadcastproducer_close( + uniffiClonePointer(), + status, + ); + }, moqExceptionErrorHandler); + } + + MoqBroadcastConsumer consume() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqbroadcastproducer_consume( uniffiClonePointer(), + status, ), - ffi_moq_ffi_rust_future_poll_u64, - ffi_moq_ffi_rust_future_complete_u64, - ffi_moq_ffi_rust_future_free_u64, - (ptr) => - FfiConverterMoqBroadcastConsumer.lift(Pointer.fromAddress(ptr)), + FfiConverterMoqBroadcastConsumer.lift, moqExceptionErrorHandler, ); } - void cancel() { + MoqBroadcastDynamic dynamic_() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqbroadcastproducer_dynamic( + uniffiClonePointer(), + status, + ), + FfiConverterMoqBroadcastDynamic.lift, + moqExceptionErrorHandler, + ); + } + + MoqTrackProducer publishTrack({ + required String name, + required MoqTrackInfo? info, + }) { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqbroadcastproducer_publish_track( + uniffiClonePointer(), + FfiConverterString.lower(name), + FfiConverterOptionalMoqTrackInfo.lower(info), + status, + ), + FfiConverterMoqTrackProducer.lift, + moqExceptionErrorHandler, + ); + } + + void unannounce() { return rustCall((status) { - uniffi_moq_ffi_fn_method_moqannouncedbroadcast_cancel( + uniffi_moq_ffi_fn_method_moqbroadcastproducer_unannounce( uniffiClonePointer(), status, ); - }, null); + }, moqExceptionErrorHandler); } } -class FfiConverterMoqAnnouncedBroadcast { - static MoqAnnouncedBroadcast lift(Pointer ptr) { - return MoqAnnouncedBroadcast.lift(ptr); +class FfiConverterMoqBroadcastProducer { + static MoqBroadcastProducer lift(Pointer ptr) { + return MoqBroadcastProducer.lift(ptr); } - static Pointer lower(MoqAnnouncedBroadcast value) { + static Pointer lower(MoqBroadcastProducer value) { return value.uniffiClonePointer(); } - static int allocationSize(MoqAnnouncedBroadcast value) { + static int allocationSize(MoqBroadcastProducer value) { return 8; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); final pointer = Pointer.fromAddress(handle); - return LiftRetVal(MoqAnnouncedBroadcast.lift(pointer), 8); + return LiftRetVal(MoqBroadcastProducer.lift(pointer), 8); } - static int write(MoqAnnouncedBroadcast value, Uint8List buf) { + static int write(MoqBroadcastProducer value, Uint8List buf) { final handle = lower(value); buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); return 8; } } -abstract class MoqBroadcastRequestInterface { - void accept({required MoqBroadcastProducer broadcast}); - String path(); - void reject({required int errorCode}); +abstract class MoqGroupProducerInterface { + void abort({required int errorCode}); + MoqGroupConsumer consume(); + void finish(); + int sequence(); + void writeFrame({required MoqFrame frame}); } -final _MoqBroadcastRequestFinalizer = Finalizer>((ptr) { - rustCall((status) => uniffi_moq_ffi_fn_free_moqbroadcastrequest(ptr, status)); +final _MoqGroupProducerFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_moq_ffi_fn_free_moqgroupproducer(ptr, status)); }); -class MoqBroadcastRequest implements MoqBroadcastRequestInterface { +class MoqGroupProducer implements MoqGroupProducerInterface { late final Pointer _ptr; bool _isDisposed = false; - MoqBroadcastRequest._(this._ptr) { - _MoqBroadcastRequestFinalizer.attach(this, _ptr, detach: this); + MoqGroupProducer._(this._ptr) { + _MoqGroupProducerFinalizer.attach(this, _ptr, detach: this); } - factory MoqBroadcastRequest.lift(Pointer ptr) { - return MoqBroadcastRequest._(ptr); + factory MoqGroupProducer.lift(Pointer ptr) { + return MoqGroupProducer._(ptr); } Pointer uniffiClonePointer() { if (_isDisposed) { throw StateError("Object has already been disposed"); } return rustCall( - (status) => uniffi_moq_ffi_fn_clone_moqbroadcastrequest(_ptr, status), + (status) => uniffi_moq_ffi_fn_clone_moqgroupproducer(_ptr, status), ); } @@ -7960,95 +10530,115 @@ class MoqBroadcastRequest implements MoqBroadcastRequestInterface { return; } _isDisposed = true; - _MoqBroadcastRequestFinalizer.detach(this); - rustCall( - (status) => uniffi_moq_ffi_fn_free_moqbroadcastrequest(_ptr, status), - ); + _MoqGroupProducerFinalizer.detach(this); + rustCall((status) => uniffi_moq_ffi_fn_free_moqgroupproducer(_ptr, status)); } - void accept({required MoqBroadcastProducer broadcast}) { + void abort({required int errorCode}) { return rustCall((status) { - uniffi_moq_ffi_fn_method_moqbroadcastrequest_accept( + uniffi_moq_ffi_fn_method_moqgroupproducer_abort( uniffiClonePointer(), - FfiConverterMoqBroadcastProducer.lower(broadcast), + FfiConverterUInt16.lower(errorCode), status, ); }, moqExceptionErrorHandler); } - String path() { + MoqGroupConsumer consume() { return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqbroadcastrequest_path( + (status) => uniffi_moq_ffi_fn_method_moqgroupproducer_consume( uniffiClonePointer(), status, ), - FfiConverterString.lift, + FfiConverterMoqGroupConsumer.lift, moqExceptionErrorHandler, ); } - void reject({required int errorCode}) { + void finish() { return rustCall((status) { - uniffi_moq_ffi_fn_method_moqbroadcastrequest_reject( + uniffi_moq_ffi_fn_method_moqgroupproducer_finish( uniffiClonePointer(), - FfiConverterUInt16.lower(errorCode), + status, + ); + }, moqExceptionErrorHandler); + } + + int sequence() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqgroupproducer_sequence( + uniffiClonePointer(), + status, + ), + FfiConverterUInt64.lift, + null, + ); + } + + void writeFrame({required MoqFrame frame}) { + return rustCall((status) { + uniffi_moq_ffi_fn_method_moqgroupproducer_write_frame( + uniffiClonePointer(), + FfiConverterMoqFrame.lower(frame), status, ); }, moqExceptionErrorHandler); } } -class FfiConverterMoqBroadcastRequest { - static MoqBroadcastRequest lift(Pointer ptr) { - return MoqBroadcastRequest.lift(ptr); +class FfiConverterMoqGroupProducer { + static MoqGroupProducer lift(Pointer ptr) { + return MoqGroupProducer.lift(ptr); } - static Pointer lower(MoqBroadcastRequest value) { + static Pointer lower(MoqGroupProducer value) { return value.uniffiClonePointer(); } - static int allocationSize(MoqBroadcastRequest value) { + static int allocationSize(MoqGroupProducer value) { return 8; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); final pointer = Pointer.fromAddress(handle); - return LiftRetVal(MoqBroadcastRequest.lift(pointer), 8); + return LiftRetVal(MoqGroupProducer.lift(pointer), 8); } - static int write(MoqBroadcastRequest value, Uint8List buf) { + static int write(MoqGroupProducer value, Uint8List buf) { final handle = lower(value); buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); return 8; } } -abstract class MoqOriginConsumerInterface { - MoqAnnounceConsumer announced({required MoqAnnounceConfig config}); - MoqAnnouncedBroadcast announcedBroadcast({required String path}); - Future requestBroadcast({required String path}); +abstract class MoqGroupRequestInterface { + void abort({required int errorCode}); + MoqGroupProducer accept(); + MoqGroupDemand demand(); + int priority(); + int sequence(); } -final _MoqOriginConsumerFinalizer = Finalizer>((ptr) { - rustCall((status) => uniffi_moq_ffi_fn_free_moqoriginconsumer(ptr, status)); +final _MoqGroupRequestFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_moq_ffi_fn_free_moqgrouprequest(ptr, status)); }); -class MoqOriginConsumer implements MoqOriginConsumerInterface { +class MoqGroupRequest implements MoqGroupRequestInterface { late final Pointer _ptr; bool _isDisposed = false; - MoqOriginConsumer._(this._ptr) { - _MoqOriginConsumerFinalizer.attach(this, _ptr, detach: this); + MoqGroupRequest._(this._ptr) { + _MoqGroupRequestFinalizer.attach(this, _ptr, detach: this); } - factory MoqOriginConsumer.lift(Pointer ptr) { - return MoqOriginConsumer._(ptr); + factory MoqGroupRequest.lift(Pointer ptr) { + return MoqGroupRequest._(ptr); } Pointer uniffiClonePointer() { if (_isDisposed) { throw StateError("Object has already been disposed"); } return rustCall( - (status) => uniffi_moq_ffi_fn_clone_moqoriginconsumer(_ptr, status), + (status) => uniffi_moq_ffi_fn_clone_moqgrouprequest(_ptr, status), ); } @@ -8057,104 +10647,115 @@ class MoqOriginConsumer implements MoqOriginConsumerInterface { return; } _isDisposed = true; - _MoqOriginConsumerFinalizer.detach(this); - rustCall( - (status) => uniffi_moq_ffi_fn_free_moqoriginconsumer(_ptr, status), + _MoqGroupRequestFinalizer.detach(this); + rustCall((status) => uniffi_moq_ffi_fn_free_moqgrouprequest(_ptr, status)); + } + + void abort({required int errorCode}) { + return rustCall((status) { + uniffi_moq_ffi_fn_method_moqgrouprequest_abort( + uniffiClonePointer(), + FfiConverterUInt16.lower(errorCode), + status, + ); + }, moqExceptionErrorHandler); + } + + MoqGroupProducer accept() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqgrouprequest_accept( + uniffiClonePointer(), + status, + ), + FfiConverterMoqGroupProducer.lift, + moqExceptionErrorHandler, ); } - MoqAnnounceConsumer announced({required MoqAnnounceConfig config}) { + MoqGroupDemand demand() { return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqoriginconsumer_announced( + (status) => uniffi_moq_ffi_fn_method_moqgrouprequest_demand( uniffiClonePointer(), - FfiConverterMoqAnnounceConfig.lower(config), status, ), - FfiConverterMoqAnnounceConsumer.lift, + FfiConverterMoqGroupDemand.lift, moqExceptionErrorHandler, ); } - MoqAnnouncedBroadcast announcedBroadcast({required String path}) { + int priority() { return rustCallWithLifter( - (status) => - uniffi_moq_ffi_fn_method_moqoriginconsumer_announced_broadcast( - uniffiClonePointer(), - FfiConverterString.lower(path), - status, - ), - FfiConverterMoqAnnouncedBroadcast.lift, - moqExceptionErrorHandler, + (status) => uniffi_moq_ffi_fn_method_moqgrouprequest_priority( + uniffiClonePointer(), + status, + ), + FfiConverterUInt8.lift, + null, ); } - Future requestBroadcast({required String path}) { - return uniffiRustCallAsync( - () => uniffi_moq_ffi_fn_method_moqoriginconsumer_request_broadcast( + int sequence() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqgrouprequest_sequence( uniffiClonePointer(), - FfiConverterString.lower(path), + status, ), - ffi_moq_ffi_rust_future_poll_u64, - ffi_moq_ffi_rust_future_complete_u64, - ffi_moq_ffi_rust_future_free_u64, - (ptr) => - FfiConverterMoqBroadcastConsumer.lift(Pointer.fromAddress(ptr)), - moqExceptionErrorHandler, + FfiConverterUInt64.lift, + null, ); } } -class FfiConverterMoqOriginConsumer { - static MoqOriginConsumer lift(Pointer ptr) { - return MoqOriginConsumer.lift(ptr); +class FfiConverterMoqGroupRequest { + static MoqGroupRequest lift(Pointer ptr) { + return MoqGroupRequest.lift(ptr); } - static Pointer lower(MoqOriginConsumer value) { + static Pointer lower(MoqGroupRequest value) { return value.uniffiClonePointer(); } - static int allocationSize(MoqOriginConsumer value) { + static int allocationSize(MoqGroupRequest value) { return 8; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); final pointer = Pointer.fromAddress(handle); - return LiftRetVal(MoqOriginConsumer.lift(pointer), 8); + return LiftRetVal(MoqGroupRequest.lift(pointer), 8); } - static int write(MoqOriginConsumer value, Uint8List buf) { + static int write(MoqGroupRequest value, Uint8List buf) { final handle = lower(value); buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); return 8; } } -abstract class MoqOriginDynamicInterface { +abstract class MoqTrackDynamicInterface { void cancel(); - Future requestedBroadcast(); - void update({required MoqRoute route}); + Future requestedGroup(); } -final _MoqOriginDynamicFinalizer = Finalizer>((ptr) { - rustCall((status) => uniffi_moq_ffi_fn_free_moqorigindynamic(ptr, status)); +final _MoqTrackDynamicFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_moq_ffi_fn_free_moqtrackdynamic(ptr, status)); }); -class MoqOriginDynamic implements MoqOriginDynamicInterface { +class MoqTrackDynamic implements MoqTrackDynamicInterface { late final Pointer _ptr; bool _isDisposed = false; - MoqOriginDynamic._(this._ptr) { - _MoqOriginDynamicFinalizer.attach(this, _ptr, detach: this); + MoqTrackDynamic._(this._ptr) { + _MoqTrackDynamicFinalizer.attach(this, _ptr, detach: this); } - factory MoqOriginDynamic.lift(Pointer ptr) { - return MoqOriginDynamic._(ptr); + factory MoqTrackDynamic.lift(Pointer ptr) { + return MoqTrackDynamic._(ptr); } Pointer uniffiClonePointer() { if (_isDisposed) { throw StateError("Object has already been disposed"); } return rustCall( - (status) => uniffi_moq_ffi_fn_clone_moqorigindynamic(_ptr, status), + (status) => uniffi_moq_ffi_fn_clone_moqtrackdynamic(_ptr, status), ); } @@ -8163,105 +10764,91 @@ class MoqOriginDynamic implements MoqOriginDynamicInterface { return; } _isDisposed = true; - _MoqOriginDynamicFinalizer.detach(this); - rustCall((status) => uniffi_moq_ffi_fn_free_moqorigindynamic(_ptr, status)); + _MoqTrackDynamicFinalizer.detach(this); + rustCall((status) => uniffi_moq_ffi_fn_free_moqtrackdynamic(_ptr, status)); } void cancel() { return rustCall((status) { - uniffi_moq_ffi_fn_method_moqorigindynamic_cancel( + uniffi_moq_ffi_fn_method_moqtrackdynamic_cancel( uniffiClonePointer(), status, ); }, null); } - Future requestedBroadcast() { + Future requestedGroup() { return uniffiRustCallAsync( - () => uniffi_moq_ffi_fn_method_moqorigindynamic_requested_broadcast( + () => uniffi_moq_ffi_fn_method_moqtrackdynamic_requested_group( uniffiClonePointer(), ), ffi_moq_ffi_rust_future_poll_u64, ffi_moq_ffi_rust_future_complete_u64, ffi_moq_ffi_rust_future_free_u64, - (ptr) => - FfiConverterMoqBroadcastRequest.lift(Pointer.fromAddress(ptr)), + (ptr) => FfiConverterMoqGroupRequest.lift(Pointer.fromAddress(ptr)), moqExceptionErrorHandler, ); } - - void update({required MoqRoute route}) { - return rustCall((status) { - uniffi_moq_ffi_fn_method_moqorigindynamic_update( - uniffiClonePointer(), - FfiConverterMoqRoute.lower(route), - status, - ); - }, moqExceptionErrorHandler); - } } -class FfiConverterMoqOriginDynamic { - static MoqOriginDynamic lift(Pointer ptr) { - return MoqOriginDynamic.lift(ptr); +class FfiConverterMoqTrackDynamic { + static MoqTrackDynamic lift(Pointer ptr) { + return MoqTrackDynamic.lift(ptr); } - static Pointer lower(MoqOriginDynamic value) { + static Pointer lower(MoqTrackDynamic value) { return value.uniffiClonePointer(); } - static int allocationSize(MoqOriginDynamic value) { + static int allocationSize(MoqTrackDynamic value) { return 8; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); final pointer = Pointer.fromAddress(handle); - return LiftRetVal(MoqOriginDynamic.lift(pointer), 8); + return LiftRetVal(MoqTrackDynamic.lift(pointer), 8); } - static int write(MoqOriginDynamic value, Uint8List buf) { + static int write(MoqTrackDynamic value, Uint8List buf) { final handle = lower(value); buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); return 8; } } -abstract class MoqOriginProducerInterface { - MoqOriginConsumer consume(); - MoqBroadcastProducer createBroadcast({required String path}); - MoqOriginDynamic dynamic_({required String prefix, required MoqRoute route}); +abstract class MoqTrackProducerInterface { + void abort({required int errorCode}); + int appendDatagram({required MoqFrame frame}); + MoqGroupProducer appendGroup(); + MoqTrackConsumer consume({required MoqSubscription? subscription}); + MoqGroupProducer createGroup({required int sequence}); + MoqTrackDemand demand(); + MoqTrackDynamic dynamic_(); + void finish(); + void finishAt({required int finalSequence}); + void writeFrame({required MoqFrame frame}); } -final _MoqOriginProducerFinalizer = Finalizer>((ptr) { - rustCall((status) => uniffi_moq_ffi_fn_free_moqoriginproducer(ptr, status)); +final _MoqTrackProducerFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_moq_ffi_fn_free_moqtrackproducer(ptr, status)); }); -class MoqOriginProducer implements MoqOriginProducerInterface { +class MoqTrackProducer implements MoqTrackProducerInterface { late final Pointer _ptr; bool _isDisposed = false; - MoqOriginProducer._(this._ptr) { - _MoqOriginProducerFinalizer.attach(this, _ptr, detach: this); - } - MoqOriginProducer({required MoqOriginConfig config}) - : _ptr = rustCall( - (status) => uniffi_moq_ffi_fn_constructor_moqoriginproducer_new( - FfiConverterMoqOriginConfig.lower(config), - status, - ), - null, - ) { - _MoqOriginProducerFinalizer.attach(this, _ptr, detach: this); + MoqTrackProducer._(this._ptr) { + _MoqTrackProducerFinalizer.attach(this, _ptr, detach: this); } - factory MoqOriginProducer.lift(Pointer ptr) { - return MoqOriginProducer._(ptr); + factory MoqTrackProducer.lift(Pointer ptr) { + return MoqTrackProducer._(ptr); } Pointer uniffiClonePointer() { if (_isDisposed) { throw StateError("Object has already been disposed"); } return rustCall( - (status) => uniffi_moq_ffi_fn_clone_moqoriginproducer(_ptr, status), + (status) => uniffi_moq_ffi_fn_clone_moqtrackproducer(_ptr, status), ); } @@ -8270,203 +10857,172 @@ class MoqOriginProducer implements MoqOriginProducerInterface { return; } _isDisposed = true; - _MoqOriginProducerFinalizer.detach(this); - rustCall( - (status) => uniffi_moq_ffi_fn_free_moqoriginproducer(_ptr, status), - ); + _MoqTrackProducerFinalizer.detach(this); + rustCall((status) => uniffi_moq_ffi_fn_free_moqtrackproducer(_ptr, status)); } - MoqOriginConsumer consume() { - return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqoriginproducer_consume( + void abort({required int errorCode}) { + return rustCall((status) { + uniffi_moq_ffi_fn_method_moqtrackproducer_abort( uniffiClonePointer(), + FfiConverterUInt16.lower(errorCode), status, - ), - FfiConverterMoqOriginConsumer.lift, - null, - ); + ); + }, moqExceptionErrorHandler); } - MoqBroadcastProducer createBroadcast({required String path}) { + int appendDatagram({required MoqFrame frame}) { return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqoriginproducer_create_broadcast( + (status) => uniffi_moq_ffi_fn_method_moqtrackproducer_append_datagram( uniffiClonePointer(), - FfiConverterString.lower(path), + FfiConverterMoqFrame.lower(frame), status, ), - FfiConverterMoqBroadcastProducer.lift, + FfiConverterUInt64.lift, moqExceptionErrorHandler, ); } - MoqOriginDynamic dynamic_({required String prefix, required MoqRoute route}) { + MoqGroupProducer appendGroup() { return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqoriginproducer_dynamic( + (status) => uniffi_moq_ffi_fn_method_moqtrackproducer_append_group( uniffiClonePointer(), - FfiConverterString.lower(prefix), - FfiConverterMoqRoute.lower(route), status, ), - FfiConverterMoqOriginDynamic.lift, + FfiConverterMoqGroupProducer.lift, moqExceptionErrorHandler, ); } -} - -class FfiConverterMoqOriginProducer { - static MoqOriginProducer lift(Pointer ptr) { - return MoqOriginProducer.lift(ptr); - } - - static Pointer lower(MoqOriginProducer value) { - return value.uniffiClonePointer(); - } - - static int allocationSize(MoqOriginProducer value) { - return 8; - } - - static LiftRetVal read(Uint8List buf) { - final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); - final pointer = Pointer.fromAddress(handle); - return LiftRetVal(MoqOriginProducer.lift(pointer), 8); - } - - static int write(MoqOriginProducer value, Uint8List buf) { - final handle = lower(value); - buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); - return 8; - } -} - -abstract class MoqBroadcastDynamicInterface { - void cancel(); - Future requestedTrack(); -} - -final _MoqBroadcastDynamicFinalizer = Finalizer>((ptr) { - rustCall((status) => uniffi_moq_ffi_fn_free_moqbroadcastdynamic(ptr, status)); -}); -class MoqBroadcastDynamic implements MoqBroadcastDynamicInterface { - late final Pointer _ptr; - bool _isDisposed = false; - MoqBroadcastDynamic._(this._ptr) { - _MoqBroadcastDynamicFinalizer.attach(this, _ptr, detach: this); - } - factory MoqBroadcastDynamic.lift(Pointer ptr) { - return MoqBroadcastDynamic._(ptr); - } - Pointer uniffiClonePointer() { - if (_isDisposed) { - throw StateError("Object has already been disposed"); - } - return rustCall( - (status) => uniffi_moq_ffi_fn_clone_moqbroadcastdynamic(_ptr, status), + MoqTrackConsumer consume({required MoqSubscription? subscription}) { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqtrackproducer_consume( + uniffiClonePointer(), + FfiConverterOptionalMoqSubscription.lower(subscription), + status, + ), + FfiConverterMoqTrackConsumer.lift, + moqExceptionErrorHandler, ); } - void dispose() { - if (_isDisposed) { - return; - } - _isDisposed = true; - _MoqBroadcastDynamicFinalizer.detach(this); - rustCall( - (status) => uniffi_moq_ffi_fn_free_moqbroadcastdynamic(_ptr, status), + MoqGroupProducer createGroup({required int sequence}) { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqtrackproducer_create_group( + uniffiClonePointer(), + FfiConverterUInt64.lower(sequence), + status, + ), + FfiConverterMoqGroupProducer.lift, + moqExceptionErrorHandler, ); } - void cancel() { - return rustCall((status) { - uniffi_moq_ffi_fn_method_moqbroadcastdynamic_cancel( + MoqTrackDemand demand() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqtrackproducer_demand( uniffiClonePointer(), status, - ); - }, null); + ), + FfiConverterMoqTrackDemand.lift, + moqExceptionErrorHandler, + ); } - Future requestedTrack() { - return uniffiRustCallAsync( - () => uniffi_moq_ffi_fn_method_moqbroadcastdynamic_requested_track( + MoqTrackDynamic dynamic_() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqtrackproducer_dynamic( uniffiClonePointer(), + status, ), - ffi_moq_ffi_rust_future_poll_u64, - ffi_moq_ffi_rust_future_complete_u64, - ffi_moq_ffi_rust_future_free_u64, - (ptr) => FfiConverterMoqTrackRequest.lift(Pointer.fromAddress(ptr)), + FfiConverterMoqTrackDynamic.lift, moqExceptionErrorHandler, ); } + + void finish() { + return rustCall((status) { + uniffi_moq_ffi_fn_method_moqtrackproducer_finish( + uniffiClonePointer(), + status, + ); + }, moqExceptionErrorHandler); + } + + void finishAt({required int finalSequence}) { + return rustCall((status) { + uniffi_moq_ffi_fn_method_moqtrackproducer_finish_at( + uniffiClonePointer(), + FfiConverterUInt64.lower(finalSequence), + status, + ); + }, moqExceptionErrorHandler); + } + + void writeFrame({required MoqFrame frame}) { + return rustCall((status) { + uniffi_moq_ffi_fn_method_moqtrackproducer_write_frame( + uniffiClonePointer(), + FfiConverterMoqFrame.lower(frame), + status, + ); + }, moqExceptionErrorHandler); + } } -class FfiConverterMoqBroadcastDynamic { - static MoqBroadcastDynamic lift(Pointer ptr) { - return MoqBroadcastDynamic.lift(ptr); +class FfiConverterMoqTrackProducer { + static MoqTrackProducer lift(Pointer ptr) { + return MoqTrackProducer.lift(ptr); } - static Pointer lower(MoqBroadcastDynamic value) { + static Pointer lower(MoqTrackProducer value) { return value.uniffiClonePointer(); } - static int allocationSize(MoqBroadcastDynamic value) { + static int allocationSize(MoqTrackProducer value) { return 8; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); final pointer = Pointer.fromAddress(handle); - return LiftRetVal(MoqBroadcastDynamic.lift(pointer), 8); + return LiftRetVal(MoqTrackProducer.lift(pointer), 8); } - static int write(MoqBroadcastDynamic value, Uint8List buf) { + static int write(MoqTrackProducer value, Uint8List buf) { final handle = lower(value); buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); return 8; } } -abstract class MoqBroadcastProducerInterface { - void announce({required MoqRoute route}); - void close(); - MoqBroadcastConsumer consume(); - MoqBroadcastDynamic dynamic_(); - MoqTrackProducer publishTrack({ - required String name, - required MoqTrackInfo? info, - }); - void unannounce(); +abstract class MoqTrackRequestInterface { + void abort({required int errorCode}); + MoqTrackProducer accept({required MoqTrackInfo? info}); + MoqTrackDemand demand(); + MoqTrackDynamic dynamic_(); + String name(); } -final _MoqBroadcastProducerFinalizer = Finalizer>((ptr) { - rustCall( - (status) => uniffi_moq_ffi_fn_free_moqbroadcastproducer(ptr, status), - ); +final _MoqTrackRequestFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_moq_ffi_fn_free_moqtrackrequest(ptr, status)); }); -class MoqBroadcastProducer implements MoqBroadcastProducerInterface { +class MoqTrackRequest implements MoqTrackRequestInterface { late final Pointer _ptr; bool _isDisposed = false; - MoqBroadcastProducer._(this._ptr) { - _MoqBroadcastProducerFinalizer.attach(this, _ptr, detach: this); - } - MoqBroadcastProducer() - : _ptr = rustCall( - (status) => - uniffi_moq_ffi_fn_constructor_moqbroadcastproducer_new(status), - moqExceptionErrorHandler, - ) { - _MoqBroadcastProducerFinalizer.attach(this, _ptr, detach: this); + MoqTrackRequest._(this._ptr) { + _MoqTrackRequestFinalizer.attach(this, _ptr, detach: this); } - factory MoqBroadcastProducer.lift(Pointer ptr) { - return MoqBroadcastProducer._(ptr); + factory MoqTrackRequest.lift(Pointer ptr) { + return MoqTrackRequest._(ptr); } Pointer uniffiClonePointer() { if (_isDisposed) { throw StateError("Object has already been disposed"); } return rustCall( - (status) => uniffi_moq_ffi_fn_clone_moqbroadcastproducer(_ptr, status), + (status) => uniffi_moq_ffi_fn_clone_moqtrackrequest(_ptr, status), ); } @@ -8475,132 +11031,124 @@ class MoqBroadcastProducer implements MoqBroadcastProducerInterface { return; } _isDisposed = true; - _MoqBroadcastProducerFinalizer.detach(this); - rustCall( - (status) => uniffi_moq_ffi_fn_free_moqbroadcastproducer(_ptr, status), - ); - } - - void announce({required MoqRoute route}) { - return rustCall((status) { - uniffi_moq_ffi_fn_method_moqbroadcastproducer_announce( - uniffiClonePointer(), - FfiConverterMoqRoute.lower(route), - status, - ); - }, moqExceptionErrorHandler); + _MoqTrackRequestFinalizer.detach(this); + rustCall((status) => uniffi_moq_ffi_fn_free_moqtrackrequest(_ptr, status)); } - void close() { + void abort({required int errorCode}) { return rustCall((status) { - uniffi_moq_ffi_fn_method_moqbroadcastproducer_close( + uniffi_moq_ffi_fn_method_moqtrackrequest_abort( uniffiClonePointer(), + FfiConverterUInt16.lower(errorCode), status, ); }, moqExceptionErrorHandler); } - MoqBroadcastConsumer consume() { + MoqTrackProducer accept({required MoqTrackInfo? info}) { return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqbroadcastproducer_consume( + (status) => uniffi_moq_ffi_fn_method_moqtrackrequest_accept( uniffiClonePointer(), + FfiConverterOptionalMoqTrackInfo.lower(info), status, ), - FfiConverterMoqBroadcastConsumer.lift, + FfiConverterMoqTrackProducer.lift, moqExceptionErrorHandler, ); } - MoqBroadcastDynamic dynamic_() { + MoqTrackDemand demand() { return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqbroadcastproducer_dynamic( + (status) => uniffi_moq_ffi_fn_method_moqtrackrequest_demand( uniffiClonePointer(), status, ), - FfiConverterMoqBroadcastDynamic.lift, + FfiConverterMoqTrackDemand.lift, moqExceptionErrorHandler, ); } - MoqTrackProducer publishTrack({ - required String name, - required MoqTrackInfo? info, - }) { + MoqTrackDynamic dynamic_() { return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqbroadcastproducer_publish_track( + (status) => uniffi_moq_ffi_fn_method_moqtrackrequest_dynamic( uniffiClonePointer(), - FfiConverterString.lower(name), - FfiConverterOptionalMoqTrackInfo.lower(info), status, ), - FfiConverterMoqTrackProducer.lift, + FfiConverterMoqTrackDynamic.lift, moqExceptionErrorHandler, ); } - void unannounce() { - return rustCall((status) { - uniffi_moq_ffi_fn_method_moqbroadcastproducer_unannounce( + String name() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqtrackrequest_name( uniffiClonePointer(), status, - ); - }, moqExceptionErrorHandler); + ), + FfiConverterString.lift, + moqExceptionErrorHandler, + ); } } -class FfiConverterMoqBroadcastProducer { - static MoqBroadcastProducer lift(Pointer ptr) { - return MoqBroadcastProducer.lift(ptr); +class FfiConverterMoqTrackRequest { + static MoqTrackRequest lift(Pointer ptr) { + return MoqTrackRequest.lift(ptr); } - static Pointer lower(MoqBroadcastProducer value) { + static Pointer lower(MoqTrackRequest value) { return value.uniffiClonePointer(); } - static int allocationSize(MoqBroadcastProducer value) { + static int allocationSize(MoqTrackRequest value) { return 8; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); final pointer = Pointer.fromAddress(handle); - return LiftRetVal(MoqBroadcastProducer.lift(pointer), 8); + return LiftRetVal(MoqTrackRequest.lift(pointer), 8); } - static int write(MoqBroadcastProducer value, Uint8List buf) { + static int write(MoqTrackRequest value, Uint8List buf) { final handle = lower(value); buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); return 8; } } -abstract class MoqGroupProducerInterface { - void abort({required int errorCode}); - MoqGroupConsumer consume(); - void finish(); - int sequence(); - void writeFrame({required MoqFrame frame}); +abstract class MoqRequestInterface { + Future accept({ + MoqOriginProducer? publish = null, + MoqOriginProducer? consume = null, + }); + void cancel(); + String path(); + String? query(); + Future reject({required int code}); + MoqTransport transport(); + String? url(); } -final _MoqGroupProducerFinalizer = Finalizer>((ptr) { - rustCall((status) => uniffi_moq_ffi_fn_free_moqgroupproducer(ptr, status)); +final _MoqRequestFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_moq_ffi_fn_free_moqrequest(ptr, status)); }); -class MoqGroupProducer implements MoqGroupProducerInterface { +class MoqRequest implements MoqRequestInterface { late final Pointer _ptr; bool _isDisposed = false; - MoqGroupProducer._(this._ptr) { - _MoqGroupProducerFinalizer.attach(this, _ptr, detach: this); + MoqRequest._(this._ptr) { + _MoqRequestFinalizer.attach(this, _ptr, detach: this); } - factory MoqGroupProducer.lift(Pointer ptr) { - return MoqGroupProducer._(ptr); + factory MoqRequest.lift(Pointer ptr) { + return MoqRequest._(ptr); } Pointer uniffiClonePointer() { if (_isDisposed) { throw StateError("Object has already been disposed"); } return rustCall( - (status) => uniffi_moq_ffi_fn_clone_moqgroupproducer(_ptr, status), + (status) => uniffi_moq_ffi_fn_clone_moqrequest(_ptr, status), ); } @@ -8609,115 +11157,153 @@ class MoqGroupProducer implements MoqGroupProducerInterface { return; } _isDisposed = true; - _MoqGroupProducerFinalizer.detach(this); - rustCall((status) => uniffi_moq_ffi_fn_free_moqgroupproducer(_ptr, status)); + _MoqRequestFinalizer.detach(this); + rustCall((status) => uniffi_moq_ffi_fn_free_moqrequest(_ptr, status)); + } + + Future accept({ + MoqOriginProducer? publish = null, + MoqOriginProducer? consume = null, + }) { + return uniffiRustCallAsync( + () => uniffi_moq_ffi_fn_method_moqrequest_accept( + uniffiClonePointer(), + FfiConverterOptionalMoqOriginProducer.lower(publish), + FfiConverterOptionalMoqOriginProducer.lower(consume), + ), + ffi_moq_ffi_rust_future_poll_u64, + ffi_moq_ffi_rust_future_complete_u64, + ffi_moq_ffi_rust_future_free_u64, + (ptr) => FfiConverterMoqSession.lift(Pointer.fromAddress(ptr)), + moqExceptionErrorHandler, + ); } - void abort({required int errorCode}) { + void cancel() { return rustCall((status) { - uniffi_moq_ffi_fn_method_moqgroupproducer_abort( + uniffi_moq_ffi_fn_method_moqrequest_cancel(uniffiClonePointer(), status); + }, null); + } + + String path() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqrequest_path( uniffiClonePointer(), - FfiConverterUInt16.lower(errorCode), status, - ); - }, moqExceptionErrorHandler); + ), + FfiConverterString.lift, + null, + ); } - MoqGroupConsumer consume() { + String? query() { return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqgroupproducer_consume( + (status) => uniffi_moq_ffi_fn_method_moqrequest_query( uniffiClonePointer(), status, ), - FfiConverterMoqGroupConsumer.lift, - moqExceptionErrorHandler, + FfiConverterOptionalString.lift, + null, ); } - void finish() { - return rustCall((status) { - uniffi_moq_ffi_fn_method_moqgroupproducer_finish( + Future reject({required int code}) { + return uniffiRustCallAsync( + () => uniffi_moq_ffi_fn_method_moqrequest_reject( uniffiClonePointer(), - status, - ); - }, moqExceptionErrorHandler); + FfiConverterUInt16.lower(code), + ), + ffi_moq_ffi_rust_future_poll_void, + ffi_moq_ffi_rust_future_complete_void, + ffi_moq_ffi_rust_future_free_void, + (_) {}, + moqExceptionErrorHandler, + ); } - int sequence() { + MoqTransport transport() { return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqgroupproducer_sequence( + (status) => uniffi_moq_ffi_fn_method_moqrequest_transport( uniffiClonePointer(), status, ), - FfiConverterUInt64.lift, + FfiConverterMoqTransport.lift, null, ); } - void writeFrame({required MoqFrame frame}) { - return rustCall((status) { - uniffi_moq_ffi_fn_method_moqgroupproducer_write_frame( - uniffiClonePointer(), - FfiConverterMoqFrame.lower(frame), - status, - ); - }, moqExceptionErrorHandler); + String? url() { + return rustCallWithLifter( + (status) => + uniffi_moq_ffi_fn_method_moqrequest_url(uniffiClonePointer(), status), + FfiConverterOptionalString.lift, + null, + ); } } -class FfiConverterMoqGroupProducer { - static MoqGroupProducer lift(Pointer ptr) { - return MoqGroupProducer.lift(ptr); +class FfiConverterMoqRequest { + static MoqRequest lift(Pointer ptr) { + return MoqRequest.lift(ptr); } - static Pointer lower(MoqGroupProducer value) { + static Pointer lower(MoqRequest value) { return value.uniffiClonePointer(); } - static int allocationSize(MoqGroupProducer value) { + static int allocationSize(MoqRequest value) { return 8; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); final pointer = Pointer.fromAddress(handle); - return LiftRetVal(MoqGroupProducer.lift(pointer), 8); + return LiftRetVal(MoqRequest.lift(pointer), 8); } - static int write(MoqGroupProducer value, Uint8List buf) { + static int write(MoqRequest value, Uint8List buf) { final handle = lower(value); buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); return 8; } } -abstract class MoqGroupRequestInterface { - void abort({required int errorCode}); - MoqGroupProducer accept(); - MoqGroupDemand demand(); - int priority(); - int sequence(); +abstract class MoqServerInterface { + Future accept(); + void cancel(); + List certFingerprints(); + Future listen(); } -final _MoqGroupRequestFinalizer = Finalizer>((ptr) { - rustCall((status) => uniffi_moq_ffi_fn_free_moqgrouprequest(ptr, status)); +final _MoqServerFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_moq_ffi_fn_free_moqserver(ptr, status)); }); -class MoqGroupRequest implements MoqGroupRequestInterface { +class MoqServer implements MoqServerInterface { late final Pointer _ptr; bool _isDisposed = false; - MoqGroupRequest._(this._ptr) { - _MoqGroupRequestFinalizer.attach(this, _ptr, detach: this); + MoqServer._(this._ptr) { + _MoqServerFinalizer.attach(this, _ptr, detach: this); } - factory MoqGroupRequest.lift(Pointer ptr) { - return MoqGroupRequest._(ptr); + MoqServer({required MoqServerConfig config}) + : _ptr = rustCall( + (status) => uniffi_moq_ffi_fn_constructor_moqserver_new( + FfiConverterMoqServerConfig.lower(config), + status, + ), + moqExceptionErrorHandler, + ) { + _MoqServerFinalizer.attach(this, _ptr, detach: this); + } + factory MoqServer.lift(Pointer ptr) { + return MoqServer._(ptr); } Pointer uniffiClonePointer() { if (_isDisposed) { throw StateError("Object has already been disposed"); } return rustCall( - (status) => uniffi_moq_ffi_fn_clone_moqgrouprequest(_ptr, status), + (status) => uniffi_moq_ffi_fn_clone_moqserver(_ptr, status), ); } @@ -8726,115 +11312,110 @@ class MoqGroupRequest implements MoqGroupRequestInterface { return; } _isDisposed = true; - _MoqGroupRequestFinalizer.detach(this); - rustCall((status) => uniffi_moq_ffi_fn_free_moqgrouprequest(_ptr, status)); - } - - void abort({required int errorCode}) { - return rustCall((status) { - uniffi_moq_ffi_fn_method_moqgrouprequest_abort( - uniffiClonePointer(), - FfiConverterUInt16.lower(errorCode), - status, - ); - }, moqExceptionErrorHandler); + _MoqServerFinalizer.detach(this); + rustCall((status) => uniffi_moq_ffi_fn_free_moqserver(_ptr, status)); } - MoqGroupProducer accept() { - return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqgrouprequest_accept( - uniffiClonePointer(), - status, - ), - FfiConverterMoqGroupProducer.lift, + Future accept() { + return uniffiRustCallAsync( + () => uniffi_moq_ffi_fn_method_moqserver_accept(uniffiClonePointer()), + ffi_moq_ffi_rust_future_poll_rust_buffer, + ffi_moq_ffi_rust_future_complete_rust_buffer, + ffi_moq_ffi_rust_future_free_rust_buffer, + FfiConverterOptionalMoqRequest.lift, moqExceptionErrorHandler, ); } - MoqGroupDemand demand() { - return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqgrouprequest_demand( - uniffiClonePointer(), - status, - ), - FfiConverterMoqGroupDemand.lift, - moqExceptionErrorHandler, - ); + void cancel() { + return rustCall((status) { + uniffi_moq_ffi_fn_method_moqserver_cancel(uniffiClonePointer(), status); + }, null); } - int priority() { + List certFingerprints() { return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqgrouprequest_priority( + (status) => uniffi_moq_ffi_fn_method_moqserver_cert_fingerprints( uniffiClonePointer(), status, ), - FfiConverterUInt8.lift, - null, + FfiConverterSequenceString.lift, + moqExceptionErrorHandler, ); } - int sequence() { - return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqgrouprequest_sequence( - uniffiClonePointer(), - status, - ), - FfiConverterUInt64.lift, - null, + Future listen() { + return uniffiRustCallAsync( + () => uniffi_moq_ffi_fn_method_moqserver_listen(uniffiClonePointer()), + ffi_moq_ffi_rust_future_poll_rust_buffer, + ffi_moq_ffi_rust_future_complete_rust_buffer, + ffi_moq_ffi_rust_future_free_rust_buffer, + FfiConverterString.lift, + moqExceptionErrorHandler, ); } } -class FfiConverterMoqGroupRequest { - static MoqGroupRequest lift(Pointer ptr) { - return MoqGroupRequest.lift(ptr); +class FfiConverterMoqServer { + static MoqServer lift(Pointer ptr) { + return MoqServer.lift(ptr); } - static Pointer lower(MoqGroupRequest value) { + static Pointer lower(MoqServer value) { return value.uniffiClonePointer(); } - static int allocationSize(MoqGroupRequest value) { + static int allocationSize(MoqServer value) { return 8; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); final pointer = Pointer.fromAddress(handle); - return LiftRetVal(MoqGroupRequest.lift(pointer), 8); + return LiftRetVal(MoqServer.lift(pointer), 8); } - static int write(MoqGroupRequest value, Uint8List buf) { + static int write(MoqServer value, Uint8List buf) { final handle = lower(value); buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); return 8; } } -abstract class MoqTrackDynamicInterface { +abstract class MoqClientInterface { void cancel(); - Future requestedGroup(); + Future connect({required String url}); } -final _MoqTrackDynamicFinalizer = Finalizer>((ptr) { - rustCall((status) => uniffi_moq_ffi_fn_free_moqtrackdynamic(ptr, status)); +final _MoqClientFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_moq_ffi_fn_free_moqclient(ptr, status)); }); -class MoqTrackDynamic implements MoqTrackDynamicInterface { +class MoqClient implements MoqClientInterface { late final Pointer _ptr; bool _isDisposed = false; - MoqTrackDynamic._(this._ptr) { - _MoqTrackDynamicFinalizer.attach(this, _ptr, detach: this); + MoqClient._(this._ptr) { + _MoqClientFinalizer.attach(this, _ptr, detach: this); } - factory MoqTrackDynamic.lift(Pointer ptr) { - return MoqTrackDynamic._(ptr); + MoqClient({required MoqClientConfig config}) + : _ptr = rustCall( + (status) => uniffi_moq_ffi_fn_constructor_moqclient_new( + FfiConverterMoqClientConfig.lower(config), + status, + ), + moqExceptionErrorHandler, + ) { + _MoqClientFinalizer.attach(this, _ptr, detach: this); + } + factory MoqClient.lift(Pointer ptr) { + return MoqClient._(ptr); } Pointer uniffiClonePointer() { if (_isDisposed) { throw StateError("Object has already been disposed"); } return rustCall( - (status) => uniffi_moq_ffi_fn_clone_moqtrackdynamic(_ptr, status), + (status) => uniffi_moq_ffi_fn_clone_moqclient(_ptr, status), ); } @@ -8843,91 +11424,88 @@ class MoqTrackDynamic implements MoqTrackDynamicInterface { return; } _isDisposed = true; - _MoqTrackDynamicFinalizer.detach(this); - rustCall((status) => uniffi_moq_ffi_fn_free_moqtrackdynamic(_ptr, status)); + _MoqClientFinalizer.detach(this); + rustCall((status) => uniffi_moq_ffi_fn_free_moqclient(_ptr, status)); } void cancel() { return rustCall((status) { - uniffi_moq_ffi_fn_method_moqtrackdynamic_cancel( - uniffiClonePointer(), - status, - ); + uniffi_moq_ffi_fn_method_moqclient_cancel(uniffiClonePointer(), status); }, null); } - Future requestedGroup() { + Future connect({required String url}) { return uniffiRustCallAsync( - () => uniffi_moq_ffi_fn_method_moqtrackdynamic_requested_group( + () => uniffi_moq_ffi_fn_method_moqclient_connect( uniffiClonePointer(), + FfiConverterString.lower(url), ), ffi_moq_ffi_rust_future_poll_u64, ffi_moq_ffi_rust_future_complete_u64, ffi_moq_ffi_rust_future_free_u64, - (ptr) => FfiConverterMoqGroupRequest.lift(Pointer.fromAddress(ptr)), + (ptr) => FfiConverterMoqSession.lift(Pointer.fromAddress(ptr)), moqExceptionErrorHandler, ); } } -class FfiConverterMoqTrackDynamic { - static MoqTrackDynamic lift(Pointer ptr) { - return MoqTrackDynamic.lift(ptr); +class FfiConverterMoqClient { + static MoqClient lift(Pointer ptr) { + return MoqClient.lift(ptr); } - static Pointer lower(MoqTrackDynamic value) { + static Pointer lower(MoqClient value) { return value.uniffiClonePointer(); } - static int allocationSize(MoqTrackDynamic value) { + static int allocationSize(MoqClient value) { return 8; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); final pointer = Pointer.fromAddress(handle); - return LiftRetVal(MoqTrackDynamic.lift(pointer), 8); + return LiftRetVal(MoqClient.lift(pointer), 8); } - static int write(MoqTrackDynamic value, Uint8List buf) { + static int write(MoqClient value, Uint8List buf) { final handle = lower(value); buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); return 8; } } -abstract class MoqTrackProducerInterface { - void abort({required int errorCode}); - int appendDatagram({required MoqFrame frame}); - MoqGroupProducer appendGroup(); - MoqTrackConsumer consume({required MoqSubscription? subscription}); - MoqGroupProducer createGroup({required int sequence}); - MoqTrackDemand demand(); - MoqTrackDynamic dynamic_(); - void finish(); - void finishAt({required int finalSequence}); - void writeFrame({required MoqFrame frame}); +abstract class MoqSessionInterface { + MoqBandwidth bandwidth(); + void cancel({required int code}); + Future closed(); + int connects(); + MoqOriginConsumer consume(); + MoqOriginProducer publish(); + Future shutdown(); + MoqConnectionStats stats(); + Future status(); } -final _MoqTrackProducerFinalizer = Finalizer>((ptr) { - rustCall((status) => uniffi_moq_ffi_fn_free_moqtrackproducer(ptr, status)); +final _MoqSessionFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_moq_ffi_fn_free_moqsession(ptr, status)); }); -class MoqTrackProducer implements MoqTrackProducerInterface { +class MoqSession implements MoqSessionInterface { late final Pointer _ptr; bool _isDisposed = false; - MoqTrackProducer._(this._ptr) { - _MoqTrackProducerFinalizer.attach(this, _ptr, detach: this); + MoqSession._(this._ptr) { + _MoqSessionFinalizer.attach(this, _ptr, detach: this); } - factory MoqTrackProducer.lift(Pointer ptr) { - return MoqTrackProducer._(ptr); + factory MoqSession.lift(Pointer ptr) { + return MoqSession._(ptr); } Pointer uniffiClonePointer() { if (_isDisposed) { throw StateError("Object has already been disposed"); } return rustCall( - (status) => uniffi_moq_ffi_fn_clone_moqtrackproducer(_ptr, status), + (status) => uniffi_moq_ffi_fn_clone_moqsession(_ptr, status), ); } @@ -8936,172 +11514,180 @@ class MoqTrackProducer implements MoqTrackProducerInterface { return; } _isDisposed = true; - _MoqTrackProducerFinalizer.detach(this); - rustCall((status) => uniffi_moq_ffi_fn_free_moqtrackproducer(_ptr, status)); - } - - void abort({required int errorCode}) { - return rustCall((status) { - uniffi_moq_ffi_fn_method_moqtrackproducer_abort( - uniffiClonePointer(), - FfiConverterUInt16.lower(errorCode), - status, - ); - }, moqExceptionErrorHandler); + _MoqSessionFinalizer.detach(this); + rustCall((status) => uniffi_moq_ffi_fn_free_moqsession(_ptr, status)); } - int appendDatagram({required MoqFrame frame}) { + MoqBandwidth bandwidth() { return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqtrackproducer_append_datagram( + (status) => uniffi_moq_ffi_fn_method_moqsession_bandwidth( uniffiClonePointer(), - FfiConverterMoqFrame.lower(frame), status, ), - FfiConverterUInt64.lift, - moqExceptionErrorHandler, + FfiConverterMoqBandwidth.lift, + null, ); } - MoqGroupProducer appendGroup() { - return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqtrackproducer_append_group( + void cancel({required int code}) { + return rustCall((status) { + uniffi_moq_ffi_fn_method_moqsession_cancel( uniffiClonePointer(), + FfiConverterUInt32.lower(code), status, - ), - FfiConverterMoqGroupProducer.lift, - moqExceptionErrorHandler, - ); + ); + }, null); } - MoqTrackConsumer consume({required MoqSubscription? subscription}) { - return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqtrackproducer_consume( - uniffiClonePointer(), - FfiConverterOptionalMoqSubscription.lower(subscription), - status, - ), - FfiConverterMoqTrackConsumer.lift, + Future closed() { + return uniffiRustCallAsync( + () => uniffi_moq_ffi_fn_method_moqsession_closed(uniffiClonePointer()), + ffi_moq_ffi_rust_future_poll_void, + ffi_moq_ffi_rust_future_complete_void, + ffi_moq_ffi_rust_future_free_void, + (_) {}, moqExceptionErrorHandler, ); } - MoqGroupProducer createGroup({required int sequence}) { + int connects() { return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqtrackproducer_create_group( + (status) => uniffi_moq_ffi_fn_method_moqsession_connects( uniffiClonePointer(), - FfiConverterUInt64.lower(sequence), status, ), - FfiConverterMoqGroupProducer.lift, - moqExceptionErrorHandler, + FfiConverterUInt64.lift, + null, ); } - MoqTrackDemand demand() { + MoqOriginConsumer consume() { return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqtrackproducer_demand( + (status) => uniffi_moq_ffi_fn_method_moqsession_consume( uniffiClonePointer(), status, ), - FfiConverterMoqTrackDemand.lift, - moqExceptionErrorHandler, + FfiConverterMoqOriginConsumer.lift, + null, ); } - MoqTrackDynamic dynamic_() { + MoqOriginProducer publish() { return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqtrackproducer_dynamic( + (status) => uniffi_moq_ffi_fn_method_moqsession_publish( uniffiClonePointer(), status, ), - FfiConverterMoqTrackDynamic.lift, - moqExceptionErrorHandler, + FfiConverterMoqOriginProducer.lift, + null, ); } - void finish() { - return rustCall((status) { - uniffi_moq_ffi_fn_method_moqtrackproducer_finish( - uniffiClonePointer(), - status, - ); - }, moqExceptionErrorHandler); + Future shutdown() { + return uniffiRustCallAsync( + () => uniffi_moq_ffi_fn_method_moqsession_shutdown(uniffiClonePointer()), + ffi_moq_ffi_rust_future_poll_void, + ffi_moq_ffi_rust_future_complete_void, + ffi_moq_ffi_rust_future_free_void, + (_) {}, + moqExceptionErrorHandler, + ); } - void finishAt({required int finalSequence}) { - return rustCall((status) { - uniffi_moq_ffi_fn_method_moqtrackproducer_finish_at( + MoqConnectionStats stats() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqsession_stats( uniffiClonePointer(), - FfiConverterUInt64.lower(finalSequence), status, - ); - }, moqExceptionErrorHandler); + ), + FfiConverterMoqConnectionStats.lift, + null, + ); } - void writeFrame({required MoqFrame frame}) { - return rustCall((status) { - uniffi_moq_ffi_fn_method_moqtrackproducer_write_frame( - uniffiClonePointer(), - FfiConverterMoqFrame.lower(frame), - status, - ); - }, moqExceptionErrorHandler); + Future status() { + return uniffiRustCallAsync( + () => uniffi_moq_ffi_fn_method_moqsession_status(uniffiClonePointer()), + ffi_moq_ffi_rust_future_poll_rust_buffer, + ffi_moq_ffi_rust_future_complete_rust_buffer, + ffi_moq_ffi_rust_future_free_rust_buffer, + FfiConverterMoqConnectionStatus.lift, + moqExceptionErrorHandler, + ); } } -class FfiConverterMoqTrackProducer { - static MoqTrackProducer lift(Pointer ptr) { - return MoqTrackProducer.lift(ptr); +class FfiConverterMoqSession { + static MoqSession lift(Pointer ptr) { + return MoqSession.lift(ptr); } - static Pointer lower(MoqTrackProducer value) { + static Pointer lower(MoqSession value) { return value.uniffiClonePointer(); } - static int allocationSize(MoqTrackProducer value) { + static int allocationSize(MoqSession value) { return 8; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); final pointer = Pointer.fromAddress(handle); - return LiftRetVal(MoqTrackProducer.lift(pointer), 8); + return LiftRetVal(MoqSession.lift(pointer), 8); } - static int write(MoqTrackProducer value, Uint8List buf) { + static int write(MoqSession value, Uint8List buf) { final handle = lower(value); buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); return 8; } } -abstract class MoqTrackRequestInterface { - void abort({required int errorCode}); - MoqTrackProducer accept({required MoqTrackInfo? info}); - MoqTrackDemand demand(); - MoqTrackDynamic dynamic_(); - String name(); +abstract class MoqVideoConsumerInterface { + void cancel(); + Future next(); } -final _MoqTrackRequestFinalizer = Finalizer>((ptr) { - rustCall((status) => uniffi_moq_ffi_fn_free_moqtrackrequest(ptr, status)); +final _MoqVideoConsumerFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_moq_ffi_fn_free_moqvideoconsumer(ptr, status)); }); -class MoqTrackRequest implements MoqTrackRequestInterface { +class MoqVideoConsumer implements MoqVideoConsumerInterface { late final Pointer _ptr; bool _isDisposed = false; - MoqTrackRequest._(this._ptr) { - _MoqTrackRequestFinalizer.attach(this, _ptr, detach: this); + MoqVideoConsumer._(this._ptr) { + _MoqVideoConsumerFinalizer.attach(this, _ptr, detach: this); } - factory MoqTrackRequest.lift(Pointer ptr) { - return MoqTrackRequest._(ptr); + static Future subscribe({ + required MoqBroadcastConsumer broadcast, + required String id, + required MoqVideo catalogVideo, + required MoqVideoDecoderOutput output, + }) { + return uniffiRustCallAsync( + () => uniffi_moq_ffi_fn_constructor_moqvideoconsumer_subscribe( + FfiConverterMoqBroadcastConsumer.lower(broadcast), + FfiConverterString.lower(id), + FfiConverterMoqVideo.lower(catalogVideo), + FfiConverterMoqVideoDecoderOutput.lower(output), + ), + ffi_moq_ffi_rust_future_poll_u64, + ffi_moq_ffi_rust_future_complete_u64, + ffi_moq_ffi_rust_future_free_u64, + (int handle) => MoqVideoConsumer._(Pointer.fromAddress(handle)), + moqExceptionErrorHandler, + ); + } + + factory MoqVideoConsumer.lift(Pointer ptr) { + return MoqVideoConsumer._(ptr); } Pointer uniffiClonePointer() { if (_isDisposed) { throw StateError("Object has already been disposed"); } return rustCall( - (status) => uniffi_moq_ffi_fn_clone_moqtrackrequest(_ptr, status), + (status) => uniffi_moq_ffi_fn_clone_moqvideoconsumer(_ptr, status), ); } @@ -9110,124 +11696,87 @@ class MoqTrackRequest implements MoqTrackRequestInterface { return; } _isDisposed = true; - _MoqTrackRequestFinalizer.detach(this); - rustCall((status) => uniffi_moq_ffi_fn_free_moqtrackrequest(_ptr, status)); + _MoqVideoConsumerFinalizer.detach(this); + rustCall((status) => uniffi_moq_ffi_fn_free_moqvideoconsumer(_ptr, status)); } - void abort({required int errorCode}) { + void cancel() { return rustCall((status) { - uniffi_moq_ffi_fn_method_moqtrackrequest_abort( + uniffi_moq_ffi_fn_method_moqvideoconsumer_cancel( uniffiClonePointer(), - FfiConverterUInt16.lower(errorCode), status, ); - }, moqExceptionErrorHandler); - } - - MoqTrackProducer accept({required MoqTrackInfo? info}) { - return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqtrackrequest_accept( - uniffiClonePointer(), - FfiConverterOptionalMoqTrackInfo.lower(info), - status, - ), - FfiConverterMoqTrackProducer.lift, - moqExceptionErrorHandler, - ); - } - - MoqTrackDemand demand() { - return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqtrackrequest_demand( - uniffiClonePointer(), - status, - ), - FfiConverterMoqTrackDemand.lift, - moqExceptionErrorHandler, - ); - } - - MoqTrackDynamic dynamic_() { - return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqtrackrequest_dynamic( - uniffiClonePointer(), - status, - ), - FfiConverterMoqTrackDynamic.lift, - moqExceptionErrorHandler, - ); + }, null); } - String name() { - return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqtrackrequest_name( - uniffiClonePointer(), - status, - ), - FfiConverterString.lift, + Future next() { + return uniffiRustCallAsync( + () => + uniffi_moq_ffi_fn_method_moqvideoconsumer_next(uniffiClonePointer()), + ffi_moq_ffi_rust_future_poll_rust_buffer, + ffi_moq_ffi_rust_future_complete_rust_buffer, + ffi_moq_ffi_rust_future_free_rust_buffer, + FfiConverterOptionalMoqVideoDecodedFrame.lift, moqExceptionErrorHandler, ); } } -class FfiConverterMoqTrackRequest { - static MoqTrackRequest lift(Pointer ptr) { - return MoqTrackRequest.lift(ptr); +class FfiConverterMoqVideoConsumer { + static MoqVideoConsumer lift(Pointer ptr) { + return MoqVideoConsumer.lift(ptr); } - static Pointer lower(MoqTrackRequest value) { + static Pointer lower(MoqVideoConsumer value) { return value.uniffiClonePointer(); } - static int allocationSize(MoqTrackRequest value) { + static int allocationSize(MoqVideoConsumer value) { return 8; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); final pointer = Pointer.fromAddress(handle); - return LiftRetVal(MoqTrackRequest.lift(pointer), 8); + return LiftRetVal(MoqVideoConsumer.lift(pointer), 8); } - static int write(MoqTrackRequest value, Uint8List buf) { + static int write(MoqVideoConsumer value, Uint8List buf) { final handle = lower(value); buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); return 8; } } -abstract class MoqRequestInterface { - Future accept({ - MoqOriginProducer? publish = null, - MoqOriginProducer? consume = null, - }); - void cancel(); - String path(); - String? query(); - Future reject({required int code}); - MoqTransport transport(); - String? url(); +abstract class MoqVideoDecodedFrameInterface { + int height(); + Uint8List pixels({required MoqVideoPixelFormat format}); + MoqVideoSurface? surface(); + int timestampUs(); + int width(); } -final _MoqRequestFinalizer = Finalizer>((ptr) { - rustCall((status) => uniffi_moq_ffi_fn_free_moqrequest(ptr, status)); +final _MoqVideoDecodedFrameFinalizer = Finalizer>((ptr) { + rustCall( + (status) => uniffi_moq_ffi_fn_free_moqvideodecodedframe(ptr, status), + ); }); -class MoqRequest implements MoqRequestInterface { +class MoqVideoDecodedFrame implements MoqVideoDecodedFrameInterface { late final Pointer _ptr; bool _isDisposed = false; - MoqRequest._(this._ptr) { - _MoqRequestFinalizer.attach(this, _ptr, detach: this); + MoqVideoDecodedFrame._(this._ptr) { + _MoqVideoDecodedFrameFinalizer.attach(this, _ptr, detach: this); } - factory MoqRequest.lift(Pointer ptr) { - return MoqRequest._(ptr); + factory MoqVideoDecodedFrame.lift(Pointer ptr) { + return MoqVideoDecodedFrame._(ptr); } Pointer uniffiClonePointer() { if (_isDisposed) { throw StateError("Object has already been disposed"); } return rustCall( - (status) => uniffi_moq_ffi_fn_clone_moqrequest(_ptr, status), + (status) => uniffi_moq_ffi_fn_clone_moqvideodecodedframe(_ptr, status), ); } @@ -9236,153 +11785,135 @@ class MoqRequest implements MoqRequestInterface { return; } _isDisposed = true; - _MoqRequestFinalizer.detach(this); - rustCall((status) => uniffi_moq_ffi_fn_free_moqrequest(_ptr, status)); - } - - Future accept({ - MoqOriginProducer? publish = null, - MoqOriginProducer? consume = null, - }) { - return uniffiRustCallAsync( - () => uniffi_moq_ffi_fn_method_moqrequest_accept( - uniffiClonePointer(), - FfiConverterOptionalMoqOriginProducer.lower(publish), - FfiConverterOptionalMoqOriginProducer.lower(consume), - ), - ffi_moq_ffi_rust_future_poll_u64, - ffi_moq_ffi_rust_future_complete_u64, - ffi_moq_ffi_rust_future_free_u64, - (ptr) => FfiConverterMoqSession.lift(Pointer.fromAddress(ptr)), - moqExceptionErrorHandler, + _MoqVideoDecodedFrameFinalizer.detach(this); + rustCall( + (status) => uniffi_moq_ffi_fn_free_moqvideodecodedframe(_ptr, status), ); } - void cancel() { - return rustCall((status) { - uniffi_moq_ffi_fn_method_moqrequest_cancel(uniffiClonePointer(), status); - }, null); - } - - String path() { + int height() { return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqrequest_path( + (status) => uniffi_moq_ffi_fn_method_moqvideodecodedframe_height( uniffiClonePointer(), status, ), - FfiConverterString.lift, + FfiConverterUInt32.lift, null, ); } - String? query() { + Uint8List pixels({required MoqVideoPixelFormat format}) { return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqrequest_query( + (status) => uniffi_moq_ffi_fn_method_moqvideodecodedframe_pixels( uniffiClonePointer(), + FfiConverterMoqVideoPixelFormat.lower(format), status, ), - FfiConverterOptionalString.lift, - null, + FfiConverterUint8List.lift, + moqExceptionErrorHandler, ); } - Future reject({required int code}) { - return uniffiRustCallAsync( - () => uniffi_moq_ffi_fn_method_moqrequest_reject( + MoqVideoSurface? surface() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqvideodecodedframe_surface( uniffiClonePointer(), - FfiConverterUInt16.lower(code), + status, ), - ffi_moq_ffi_rust_future_poll_void, - ffi_moq_ffi_rust_future_complete_void, - ffi_moq_ffi_rust_future_free_void, - (_) {}, - moqExceptionErrorHandler, + FfiConverterOptionalMoqVideoSurface.lift, + null, ); } - MoqTransport transport() { + int timestampUs() { return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqrequest_transport( + (status) => uniffi_moq_ffi_fn_method_moqvideodecodedframe_timestamp_us( uniffiClonePointer(), status, ), - FfiConverterMoqTransport.lift, + FfiConverterUInt64.lift, null, ); } - String? url() { + int width() { return rustCallWithLifter( - (status) => - uniffi_moq_ffi_fn_method_moqrequest_url(uniffiClonePointer(), status), - FfiConverterOptionalString.lift, + (status) => uniffi_moq_ffi_fn_method_moqvideodecodedframe_width( + uniffiClonePointer(), + status, + ), + FfiConverterUInt32.lift, null, ); } } -class FfiConverterMoqRequest { - static MoqRequest lift(Pointer ptr) { - return MoqRequest.lift(ptr); +class FfiConverterMoqVideoDecodedFrame { + static MoqVideoDecodedFrame lift(Pointer ptr) { + return MoqVideoDecodedFrame.lift(ptr); } - static Pointer lower(MoqRequest value) { + static Pointer lower(MoqVideoDecodedFrame value) { return value.uniffiClonePointer(); } - static int allocationSize(MoqRequest value) { + static int allocationSize(MoqVideoDecodedFrame value) { return 8; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); final pointer = Pointer.fromAddress(handle); - return LiftRetVal(MoqRequest.lift(pointer), 8); + return LiftRetVal(MoqVideoDecodedFrame.lift(pointer), 8); } - static int write(MoqRequest value, Uint8List buf) { + static int write(MoqVideoDecodedFrame value, Uint8List buf) { final handle = lower(value); buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); return 8; } } -abstract class MoqServerInterface { - Future accept(); - void cancel(); - List certFingerprints(); - Future listen(); +abstract class MoqVideoEncoderInterface { + void cut(); + List encode({required MoqVideoFrame frame}); + List finish(); + List flush(); + void setBitrate({required int bitrate}); } -final _MoqServerFinalizer = Finalizer>((ptr) { - rustCall((status) => uniffi_moq_ffi_fn_free_moqserver(ptr, status)); +final _MoqVideoEncoderFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_moq_ffi_fn_free_moqvideoencoder(ptr, status)); }); -class MoqServer implements MoqServerInterface { +class MoqVideoEncoder implements MoqVideoEncoderInterface { late final Pointer _ptr; bool _isDisposed = false; - MoqServer._(this._ptr) { - _MoqServerFinalizer.attach(this, _ptr, detach: this); + MoqVideoEncoder._(this._ptr) { + _MoqVideoEncoderFinalizer.attach(this, _ptr, detach: this); } - MoqServer({required MoqServerConfig config}) - : _ptr = rustCall( - (status) => uniffi_moq_ffi_fn_constructor_moqserver_new( - FfiConverterMoqServerConfig.lower(config), - status, - ), - moqExceptionErrorHandler, - ) { - _MoqServerFinalizer.attach(this, _ptr, detach: this); + MoqVideoEncoder({ + required MoqVideoEncoderInput input, + required MoqVideoEncoderOutput output, + }) : _ptr = rustCall( + (status) => uniffi_moq_ffi_fn_constructor_moqvideoencoder_new( + FfiConverterMoqVideoEncoderInput.lower(input), + FfiConverterMoqVideoEncoderOutput.lower(output), + status, + ), + moqExceptionErrorHandler, + ) { + _MoqVideoEncoderFinalizer.attach(this, _ptr, detach: this); } - factory MoqServer.lift(Pointer ptr) { - return MoqServer._(ptr); + factory MoqVideoEncoder.lift(Pointer ptr) { + return MoqVideoEncoder._(ptr); } Pointer uniffiClonePointer() { if (_isDisposed) { throw StateError("Object has already been disposed"); } return rustCall( - (status) => uniffi_moq_ffi_fn_clone_moqserver(_ptr, status), + (status) => uniffi_moq_ffi_fn_clone_moqvideoencoder(_ptr, status), ); } @@ -9391,200 +11922,135 @@ class MoqServer implements MoqServerInterface { return; } _isDisposed = true; - _MoqServerFinalizer.detach(this); - rustCall((status) => uniffi_moq_ffi_fn_free_moqserver(_ptr, status)); - } - - Future accept() { - return uniffiRustCallAsync( - () => uniffi_moq_ffi_fn_method_moqserver_accept(uniffiClonePointer()), - ffi_moq_ffi_rust_future_poll_rust_buffer, - ffi_moq_ffi_rust_future_complete_rust_buffer, - ffi_moq_ffi_rust_future_free_rust_buffer, - FfiConverterOptionalMoqRequest.lift, - moqExceptionErrorHandler, - ); + _MoqVideoEncoderFinalizer.detach(this); + rustCall((status) => uniffi_moq_ffi_fn_free_moqvideoencoder(_ptr, status)); } - void cancel() { + void cut() { return rustCall((status) { - uniffi_moq_ffi_fn_method_moqserver_cancel(uniffiClonePointer(), status); - }, null); + uniffi_moq_ffi_fn_method_moqvideoencoder_cut( + uniffiClonePointer(), + status, + ); + }, moqExceptionErrorHandler); } - List certFingerprints() { + List encode({required MoqVideoFrame frame}) { return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqserver_cert_fingerprints( + (status) => uniffi_moq_ffi_fn_method_moqvideoencoder_encode( uniffiClonePointer(), + FfiConverterMoqVideoFrame.lower(frame), status, ), - FfiConverterSequenceString.lift, + FfiConverterSequenceMoqVideoPacket.lift, moqExceptionErrorHandler, ); } - Future listen() { - return uniffiRustCallAsync( - () => uniffi_moq_ffi_fn_method_moqserver_listen(uniffiClonePointer()), - ffi_moq_ffi_rust_future_poll_rust_buffer, - ffi_moq_ffi_rust_future_complete_rust_buffer, - ffi_moq_ffi_rust_future_free_rust_buffer, - FfiConverterString.lift, + List finish() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqvideoencoder_finish( + uniffiClonePointer(), + status, + ), + FfiConverterSequenceMoqVideoPacket.lift, moqExceptionErrorHandler, ); } -} - -class FfiConverterMoqServer { - static MoqServer lift(Pointer ptr) { - return MoqServer.lift(ptr); - } - - static Pointer lower(MoqServer value) { - return value.uniffiClonePointer(); - } - - static int allocationSize(MoqServer value) { - return 8; - } - - static LiftRetVal read(Uint8List buf) { - final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); - final pointer = Pointer.fromAddress(handle); - return LiftRetVal(MoqServer.lift(pointer), 8); - } - - static int write(MoqServer value, Uint8List buf) { - final handle = lower(value); - buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); - return 8; - } -} - -abstract class MoqClientInterface { - void cancel(); - Future connect({required String url}); -} - -final _MoqClientFinalizer = Finalizer>((ptr) { - rustCall((status) => uniffi_moq_ffi_fn_free_moqclient(ptr, status)); -}); -class MoqClient implements MoqClientInterface { - late final Pointer _ptr; - bool _isDisposed = false; - MoqClient._(this._ptr) { - _MoqClientFinalizer.attach(this, _ptr, detach: this); - } - MoqClient({required MoqClientConfig config}) - : _ptr = rustCall( - (status) => uniffi_moq_ffi_fn_constructor_moqclient_new( - FfiConverterMoqClientConfig.lower(config), - status, - ), - moqExceptionErrorHandler, - ) { - _MoqClientFinalizer.attach(this, _ptr, detach: this); - } - factory MoqClient.lift(Pointer ptr) { - return MoqClient._(ptr); - } - Pointer uniffiClonePointer() { - if (_isDisposed) { - throw StateError("Object has already been disposed"); - } - return rustCall( - (status) => uniffi_moq_ffi_fn_clone_moqclient(_ptr, status), + List flush() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqvideoencoder_flush( + uniffiClonePointer(), + status, + ), + FfiConverterSequenceMoqVideoPacket.lift, + moqExceptionErrorHandler, ); } - void dispose() { - if (_isDisposed) { - return; - } - _isDisposed = true; - _MoqClientFinalizer.detach(this); - rustCall((status) => uniffi_moq_ffi_fn_free_moqclient(_ptr, status)); - } - - void cancel() { + void setBitrate({required int bitrate}) { return rustCall((status) { - uniffi_moq_ffi_fn_method_moqclient_cancel(uniffiClonePointer(), status); - }, null); - } - - Future connect({required String url}) { - return uniffiRustCallAsync( - () => uniffi_moq_ffi_fn_method_moqclient_connect( + uniffi_moq_ffi_fn_method_moqvideoencoder_set_bitrate( uniffiClonePointer(), - FfiConverterString.lower(url), - ), - ffi_moq_ffi_rust_future_poll_u64, - ffi_moq_ffi_rust_future_complete_u64, - ffi_moq_ffi_rust_future_free_u64, - (ptr) => FfiConverterMoqSession.lift(Pointer.fromAddress(ptr)), - moqExceptionErrorHandler, - ); + FfiConverterUInt64.lower(bitrate), + status, + ); + }, moqExceptionErrorHandler); } } -class FfiConverterMoqClient { - static MoqClient lift(Pointer ptr) { - return MoqClient.lift(ptr); +class FfiConverterMoqVideoEncoder { + static MoqVideoEncoder lift(Pointer ptr) { + return MoqVideoEncoder.lift(ptr); } - static Pointer lower(MoqClient value) { + static Pointer lower(MoqVideoEncoder value) { return value.uniffiClonePointer(); } - static int allocationSize(MoqClient value) { + static int allocationSize(MoqVideoEncoder value) { return 8; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); final pointer = Pointer.fromAddress(handle); - return LiftRetVal(MoqClient.lift(pointer), 8); + return LiftRetVal(MoqVideoEncoder.lift(pointer), 8); } - static int write(MoqClient value, Uint8List buf) { + static int write(MoqVideoEncoder value, Uint8List buf) { final handle = lower(value); buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); return 8; } } -abstract class MoqSessionInterface { - MoqBandwidth bandwidth(); - void cancel({required int code}); - Future closed(); - int connects(); - MoqOriginConsumer consume(); - MoqOriginProducer publish(); - Future shutdown(); - MoqConnectionStats stats(); - Future status(); +abstract class MoqVideoProducerInterface { + void cut(); + MoqTrackDemand demand(); + void finish(); + MoqReservation? reservation(); + void setBitrate({required int bitrate}); + void write({required MoqVideoFrame frame}); } -final _MoqSessionFinalizer = Finalizer>((ptr) { - rustCall((status) => uniffi_moq_ffi_fn_free_moqsession(ptr, status)); +final _MoqVideoProducerFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_moq_ffi_fn_free_moqvideoproducer(ptr, status)); }); -class MoqSession implements MoqSessionInterface { +class MoqVideoProducer implements MoqVideoProducerInterface { late final Pointer _ptr; bool _isDisposed = false; - MoqSession._(this._ptr) { - _MoqSessionFinalizer.attach(this, _ptr, detach: this); + MoqVideoProducer._(this._ptr) { + _MoqVideoProducerFinalizer.attach(this, _ptr, detach: this); + } + MoqVideoProducer({ + required MoqMediaCatalogProducer catalog, + required MoqVideoEncoderInput input, + required MoqVideoEncoderOutput output, + MoqBandwidth? bandwidth = null, + }) : _ptr = rustCall( + (status) => uniffi_moq_ffi_fn_constructor_moqvideoproducer_new( + FfiConverterMoqMediaCatalogProducer.lower(catalog), + FfiConverterMoqVideoEncoderInput.lower(input), + FfiConverterMoqVideoEncoderOutput.lower(output), + FfiConverterOptionalMoqBandwidth.lower(bandwidth), + status, + ), + moqExceptionErrorHandler, + ) { + _MoqVideoProducerFinalizer.attach(this, _ptr, detach: this); } - factory MoqSession.lift(Pointer ptr) { - return MoqSession._(ptr); + factory MoqVideoProducer.lift(Pointer ptr) { + return MoqVideoProducer._(ptr); } Pointer uniffiClonePointer() { if (_isDisposed) { throw StateError("Object has already been disposed"); } return rustCall( - (status) => uniffi_moq_ffi_fn_clone_moqsession(_ptr, status), + (status) => uniffi_moq_ffi_fn_clone_moqvideoproducer(_ptr, status), ); } @@ -9593,129 +12059,91 @@ class MoqSession implements MoqSessionInterface { return; } _isDisposed = true; - _MoqSessionFinalizer.detach(this); - rustCall((status) => uniffi_moq_ffi_fn_free_moqsession(_ptr, status)); - } - - MoqBandwidth bandwidth() { - return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqsession_bandwidth( - uniffiClonePointer(), - status, - ), - FfiConverterMoqBandwidth.lift, - null, - ); + _MoqVideoProducerFinalizer.detach(this); + rustCall((status) => uniffi_moq_ffi_fn_free_moqvideoproducer(_ptr, status)); } - void cancel({required int code}) { + void cut() { return rustCall((status) { - uniffi_moq_ffi_fn_method_moqsession_cancel( + uniffi_moq_ffi_fn_method_moqvideoproducer_cut( uniffiClonePointer(), - FfiConverterUInt32.lower(code), status, ); - }, null); - } - - Future closed() { - return uniffiRustCallAsync( - () => uniffi_moq_ffi_fn_method_moqsession_closed(uniffiClonePointer()), - ffi_moq_ffi_rust_future_poll_void, - ffi_moq_ffi_rust_future_complete_void, - ffi_moq_ffi_rust_future_free_void, - (_) {}, - moqExceptionErrorHandler, - ); + }, moqExceptionErrorHandler); } - int connects() { + MoqTrackDemand demand() { return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqsession_connects( + (status) => uniffi_moq_ffi_fn_method_moqvideoproducer_demand( uniffiClonePointer(), status, ), - FfiConverterUInt64.lift, - null, + FfiConverterMoqTrackDemand.lift, + moqExceptionErrorHandler, ); } - MoqOriginConsumer consume() { - return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqsession_consume( + void finish() { + return rustCall((status) { + uniffi_moq_ffi_fn_method_moqvideoproducer_finish( uniffiClonePointer(), status, - ), - FfiConverterMoqOriginConsumer.lift, - null, - ); + ); + }, moqExceptionErrorHandler); } - MoqOriginProducer publish() { + MoqReservation? reservation() { return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqsession_publish( + (status) => uniffi_moq_ffi_fn_method_moqvideoproducer_reservation( uniffiClonePointer(), status, ), - FfiConverterMoqOriginProducer.lift, + FfiConverterOptionalMoqReservation.lift, null, ); } - Future shutdown() { - return uniffiRustCallAsync( - () => uniffi_moq_ffi_fn_method_moqsession_shutdown(uniffiClonePointer()), - ffi_moq_ffi_rust_future_poll_void, - ffi_moq_ffi_rust_future_complete_void, - ffi_moq_ffi_rust_future_free_void, - (_) {}, - moqExceptionErrorHandler, - ); - } - - MoqConnectionStats stats() { - return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqsession_stats( + void setBitrate({required int bitrate}) { + return rustCall((status) { + uniffi_moq_ffi_fn_method_moqvideoproducer_set_bitrate( uniffiClonePointer(), + FfiConverterUInt64.lower(bitrate), status, - ), - FfiConverterMoqConnectionStats.lift, - null, - ); + ); + }, moqExceptionErrorHandler); } - Future status() { - return uniffiRustCallAsync( - () => uniffi_moq_ffi_fn_method_moqsession_status(uniffiClonePointer()), - ffi_moq_ffi_rust_future_poll_rust_buffer, - ffi_moq_ffi_rust_future_complete_rust_buffer, - ffi_moq_ffi_rust_future_free_rust_buffer, - FfiConverterMoqConnectionStatus.lift, - moqExceptionErrorHandler, - ); + void write({required MoqVideoFrame frame}) { + return rustCall((status) { + uniffi_moq_ffi_fn_method_moqvideoproducer_write( + uniffiClonePointer(), + FfiConverterMoqVideoFrame.lower(frame), + status, + ); + }, moqExceptionErrorHandler); } } -class FfiConverterMoqSession { - static MoqSession lift(Pointer ptr) { - return MoqSession.lift(ptr); +class FfiConverterMoqVideoProducer { + static MoqVideoProducer lift(Pointer ptr) { + return MoqVideoProducer.lift(ptr); } - static Pointer lower(MoqSession value) { + static Pointer lower(MoqVideoProducer value) { return value.uniffiClonePointer(); } - static int allocationSize(MoqSession value) { + static int allocationSize(MoqVideoProducer value) { return 8; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); final pointer = Pointer.fromAddress(handle); - return LiftRetVal(MoqSession.lift(pointer), 8); + return LiftRetVal(MoqVideoProducer.lift(pointer), 8); } - static int write(MoqSession value, Uint8List buf) { + static int write(MoqVideoProducer value, Uint8List buf) { final handle = lower(value); buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); return 8; @@ -9749,6 +12177,26 @@ class FfiConverterBool { } } +class FfiConverterDouble32 { + static double lift(double value) => value; + static LiftRetVal read(Uint8List buf) { + return LiftRetVal( + buf.buffer.asByteData(buf.offsetInBytes).getFloat32(0), + 4, + ); + } + + static double lower(double value) => value; + static int allocationSize([double value = 0]) { + return 4; + } + + static int write(double value, Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setFloat32(0, value); + return FfiConverterDouble32.allocationSize(); + } +} + class FfiConverterDouble64 { static double lift(double value) => value; static LiftRetVal read(Uint8List buf) { @@ -9918,51 +12366,190 @@ class FfiConverterMapStringToString { .fold(4, (a, b) => a + b); } - static RustBuffer lower(Map value) { - final buf = Uint8List(allocationSize(value)); - write(value, buf); + static RustBuffer lower(Map value) { + final buf = Uint8List(allocationSize(value)); + write(value, buf); + return toRustBuffer(buf); + } +} + +class FfiConverterOptionalBool { + static bool? lift(RustBuffer buf) { + return FfiConverterOptionalBool.read(buf.asUint8List()).value; + } + + static LiftRetVal read(Uint8List buf) { + if (ByteData.view(buf.buffer, buf.offsetInBytes).getInt8(0) == 0) { + return LiftRetVal(null, 1); + } + final result = FfiConverterBool.read( + Uint8List.view(buf.buffer, buf.offsetInBytes + 1), + ); + return LiftRetVal(result.value, result.bytesRead + 1); + } + + static int allocationSize([bool? value]) { + if (value == null) { + return 1; + } + return FfiConverterBool.allocationSize(value) + 1; + } + + static RustBuffer lower(bool? value) { + if (value == null) { + return toRustBuffer(Uint8List.fromList([0])); + } + final buf = Uint8List(FfiConverterOptionalBool.allocationSize(value)); + FfiConverterOptionalBool.write(value, buf); + return toRustBuffer(buf); + } + + static int write(bool? value, Uint8List buf) { + if (value == null) { + buf[0] = 0; + return 1; + } + buf[0] = 1; + return FfiConverterBool.write( + value, + Uint8List.view(buf.buffer, buf.offsetInBytes + 1), + ) + + 1; + } +} + +class FfiConverterOptionalDouble64 { + static double? lift(RustBuffer buf) { + return FfiConverterOptionalDouble64.read(buf.asUint8List()).value; + } + + static LiftRetVal read(Uint8List buf) { + if (ByteData.view(buf.buffer, buf.offsetInBytes).getInt8(0) == 0) { + return LiftRetVal(null, 1); + } + final result = FfiConverterDouble64.read( + Uint8List.view(buf.buffer, buf.offsetInBytes + 1), + ); + return LiftRetVal(result.value, result.bytesRead + 1); + } + + static int allocationSize([double? value]) { + if (value == null) { + return 1; + } + return FfiConverterDouble64.allocationSize(value) + 1; + } + + static RustBuffer lower(double? value) { + if (value == null) { + return toRustBuffer(Uint8List.fromList([0])); + } + final buf = Uint8List(FfiConverterOptionalDouble64.allocationSize(value)); + FfiConverterOptionalDouble64.write(value, buf); + return toRustBuffer(buf); + } + + static int write(double? value, Uint8List buf) { + if (value == null) { + buf[0] = 0; + return 1; + } + buf[0] = 1; + return FfiConverterDouble64.write( + value, + Uint8List.view(buf.buffer, buf.offsetInBytes + 1), + ) + + 1; + } +} + +class FfiConverterOptionalMoqAnnounceEvent { + static MoqAnnounceEvent? lift(RustBuffer buf) { + return FfiConverterOptionalMoqAnnounceEvent.read(buf.asUint8List()).value; + } + + static LiftRetVal read(Uint8List buf) { + if (ByteData.view(buf.buffer, buf.offsetInBytes).getInt8(0) == 0) { + return LiftRetVal(null, 1); + } + final result = FfiConverterMoqAnnounceEvent.read( + Uint8List.view(buf.buffer, buf.offsetInBytes + 1), + ); + return LiftRetVal(result.value, result.bytesRead + 1); + } + + static int allocationSize([MoqAnnounceEvent? value]) { + if (value == null) { + return 1; + } + return FfiConverterMoqAnnounceEvent.allocationSize(value) + 1; + } + + static RustBuffer lower(MoqAnnounceEvent? value) { + if (value == null) { + return toRustBuffer(Uint8List.fromList([0])); + } + final buf = Uint8List( + FfiConverterOptionalMoqAnnounceEvent.allocationSize(value), + ); + FfiConverterOptionalMoqAnnounceEvent.write(value, buf); return toRustBuffer(buf); } + + static int write(MoqAnnounceEvent? value, Uint8List buf) { + if (value == null) { + buf[0] = 0; + return 1; + } + buf[0] = 1; + return FfiConverterMoqAnnounceEvent.write( + value, + Uint8List.view(buf.buffer, buf.offsetInBytes + 1), + ) + + 1; + } } -class FfiConverterOptionalBool { - static bool? lift(RustBuffer buf) { - return FfiConverterOptionalBool.read(buf.asUint8List()).value; +class FfiConverterOptionalMoqAudioFrame { + static MoqAudioFrame? lift(RustBuffer buf) { + return FfiConverterOptionalMoqAudioFrame.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { if (ByteData.view(buf.buffer, buf.offsetInBytes).getInt8(0) == 0) { return LiftRetVal(null, 1); } - final result = FfiConverterBool.read( + final result = FfiConverterMoqAudioFrame.read( Uint8List.view(buf.buffer, buf.offsetInBytes + 1), ); - return LiftRetVal(result.value, result.bytesRead + 1); + return LiftRetVal(result.value, result.bytesRead + 1); } - static int allocationSize([bool? value]) { + static int allocationSize([MoqAudioFrame? value]) { if (value == null) { return 1; } - return FfiConverterBool.allocationSize(value) + 1; + return FfiConverterMoqAudioFrame.allocationSize(value) + 1; } - static RustBuffer lower(bool? value) { + static RustBuffer lower(MoqAudioFrame? value) { if (value == null) { return toRustBuffer(Uint8List.fromList([0])); } - final buf = Uint8List(FfiConverterOptionalBool.allocationSize(value)); - FfiConverterOptionalBool.write(value, buf); + final buf = Uint8List( + FfiConverterOptionalMoqAudioFrame.allocationSize(value), + ); + FfiConverterOptionalMoqAudioFrame.write(value, buf); return toRustBuffer(buf); } - static int write(bool? value, Uint8List buf) { + static int write(MoqAudioFrame? value, Uint8List buf) { if (value == null) { buf[0] = 0; return 1; } buf[0] = 1; - return FfiConverterBool.write( + return FfiConverterMoqAudioFrame.write( value, Uint8List.view(buf.buffer, buf.offsetInBytes + 1), ) + @@ -9970,44 +12557,46 @@ class FfiConverterOptionalBool { } } -class FfiConverterOptionalDouble64 { - static double? lift(RustBuffer buf) { - return FfiConverterOptionalDouble64.read(buf.asUint8List()).value; +class FfiConverterOptionalMoqAudioPreset { + static MoqAudioPreset? lift(RustBuffer buf) { + return FfiConverterOptionalMoqAudioPreset.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { if (ByteData.view(buf.buffer, buf.offsetInBytes).getInt8(0) == 0) { return LiftRetVal(null, 1); } - final result = FfiConverterDouble64.read( + final result = FfiConverterMoqAudioPreset.read( Uint8List.view(buf.buffer, buf.offsetInBytes + 1), ); - return LiftRetVal(result.value, result.bytesRead + 1); + return LiftRetVal(result.value, result.bytesRead + 1); } - static int allocationSize([double? value]) { + static int allocationSize([MoqAudioPreset? value]) { if (value == null) { return 1; } - return FfiConverterDouble64.allocationSize(value) + 1; + return FfiConverterMoqAudioPreset.allocationSize(value) + 1; } - static RustBuffer lower(double? value) { + static RustBuffer lower(MoqAudioPreset? value) { if (value == null) { return toRustBuffer(Uint8List.fromList([0])); } - final buf = Uint8List(FfiConverterOptionalDouble64.allocationSize(value)); - FfiConverterOptionalDouble64.write(value, buf); + final buf = Uint8List( + FfiConverterOptionalMoqAudioPreset.allocationSize(value), + ); + FfiConverterOptionalMoqAudioPreset.write(value, buf); return toRustBuffer(buf); } - static int write(double? value, Uint8List buf) { + static int write(MoqAudioPreset? value, Uint8List buf) { if (value == null) { buf[0] = 0; return 1; } buf[0] = 1; - return FfiConverterDouble64.write( + return FfiConverterMoqAudioPreset.write( value, Uint8List.view(buf.buffer, buf.offsetInBytes + 1), ) + @@ -10015,46 +12604,46 @@ class FfiConverterOptionalDouble64 { } } -class FfiConverterOptionalMoqAnnounceEvent { - static MoqAnnounceEvent? lift(RustBuffer buf) { - return FfiConverterOptionalMoqAnnounceEvent.read(buf.asUint8List()).value; +class FfiConverterOptionalMoqBandwidth { + static MoqBandwidth? lift(RustBuffer buf) { + return FfiConverterOptionalMoqBandwidth.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { if (ByteData.view(buf.buffer, buf.offsetInBytes).getInt8(0) == 0) { return LiftRetVal(null, 1); } - final result = FfiConverterMoqAnnounceEvent.read( + final result = FfiConverterMoqBandwidth.read( Uint8List.view(buf.buffer, buf.offsetInBytes + 1), ); - return LiftRetVal(result.value, result.bytesRead + 1); + return LiftRetVal(result.value, result.bytesRead + 1); } - static int allocationSize([MoqAnnounceEvent? value]) { + static int allocationSize([MoqBandwidth? value]) { if (value == null) { return 1; } - return FfiConverterMoqAnnounceEvent.allocationSize(value) + 1; + return FfiConverterMoqBandwidth.allocationSize(value) + 1; } - static RustBuffer lower(MoqAnnounceEvent? value) { + static RustBuffer lower(MoqBandwidth? value) { if (value == null) { return toRustBuffer(Uint8List.fromList([0])); } final buf = Uint8List( - FfiConverterOptionalMoqAnnounceEvent.allocationSize(value), + FfiConverterOptionalMoqBandwidth.allocationSize(value), ); - FfiConverterOptionalMoqAnnounceEvent.write(value, buf); + FfiConverterOptionalMoqBandwidth.write(value, buf); return toRustBuffer(buf); } - static int write(MoqAnnounceEvent? value, Uint8List buf) { + static int write(MoqBandwidth? value, Uint8List buf) { if (value == null) { buf[0] = 0; return 1; } buf[0] = 1; - return FfiConverterMoqAnnounceEvent.write( + return FfiConverterMoqBandwidth.write( value, Uint8List.view(buf.buffer, buf.offsetInBytes + 1), ) + @@ -10350,41 +12939,227 @@ class FfiConverterOptionalMoqMediaFrame { return FfiConverterOptionalMoqMediaFrame.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { + if (ByteData.view(buf.buffer, buf.offsetInBytes).getInt8(0) == 0) { + return LiftRetVal(null, 1); + } + final result = FfiConverterMoqMediaFrame.read( + Uint8List.view(buf.buffer, buf.offsetInBytes + 1), + ); + return LiftRetVal(result.value, result.bytesRead + 1); + } + + static int allocationSize([MoqMediaFrame? value]) { + if (value == null) { + return 1; + } + return FfiConverterMoqMediaFrame.allocationSize(value) + 1; + } + + static RustBuffer lower(MoqMediaFrame? value) { + if (value == null) { + return toRustBuffer(Uint8List.fromList([0])); + } + final buf = Uint8List( + FfiConverterOptionalMoqMediaFrame.allocationSize(value), + ); + FfiConverterOptionalMoqMediaFrame.write(value, buf); + return toRustBuffer(buf); + } + + static int write(MoqMediaFrame? value, Uint8List buf) { + if (value == null) { + buf[0] = 0; + return 1; + } + buf[0] = 1; + return FfiConverterMoqMediaFrame.write( + value, + Uint8List.view(buf.buffer, buf.offsetInBytes + 1), + ) + + 1; + } +} + +class FfiConverterOptionalMoqMediaTimebase { + static MoqMediaTimebase? lift(RustBuffer buf) { + return FfiConverterOptionalMoqMediaTimebase.read(buf.asUint8List()).value; + } + + static LiftRetVal read(Uint8List buf) { + if (ByteData.view(buf.buffer, buf.offsetInBytes).getInt8(0) == 0) { + return LiftRetVal(null, 1); + } + final result = FfiConverterMoqMediaTimebase.read( + Uint8List.view(buf.buffer, buf.offsetInBytes + 1), + ); + return LiftRetVal(result.value, result.bytesRead + 1); + } + + static int allocationSize([MoqMediaTimebase? value]) { + if (value == null) { + return 1; + } + return FfiConverterMoqMediaTimebase.allocationSize(value) + 1; + } + + static RustBuffer lower(MoqMediaTimebase? value) { + if (value == null) { + return toRustBuffer(Uint8List.fromList([0])); + } + final buf = Uint8List( + FfiConverterOptionalMoqMediaTimebase.allocationSize(value), + ); + FfiConverterOptionalMoqMediaTimebase.write(value, buf); + return toRustBuffer(buf); + } + + static int write(MoqMediaTimebase? value, Uint8List buf) { + if (value == null) { + buf[0] = 0; + return 1; + } + buf[0] = 1; + return FfiConverterMoqMediaTimebase.write( + value, + Uint8List.view(buf.buffer, buf.offsetInBytes + 1), + ) + + 1; + } +} + +class FfiConverterOptionalMoqOriginProducer { + static MoqOriginProducer? lift(RustBuffer buf) { + return FfiConverterOptionalMoqOriginProducer.read(buf.asUint8List()).value; + } + + static LiftRetVal read(Uint8List buf) { + if (ByteData.view(buf.buffer, buf.offsetInBytes).getInt8(0) == 0) { + return LiftRetVal(null, 1); + } + final result = FfiConverterMoqOriginProducer.read( + Uint8List.view(buf.buffer, buf.offsetInBytes + 1), + ); + return LiftRetVal(result.value, result.bytesRead + 1); + } + + static int allocationSize([MoqOriginProducer? value]) { + if (value == null) { + return 1; + } + return FfiConverterMoqOriginProducer.allocationSize(value) + 1; + } + + static RustBuffer lower(MoqOriginProducer? value) { + if (value == null) { + return toRustBuffer(Uint8List.fromList([0])); + } + final buf = Uint8List( + FfiConverterOptionalMoqOriginProducer.allocationSize(value), + ); + FfiConverterOptionalMoqOriginProducer.write(value, buf); + return toRustBuffer(buf); + } + + static int write(MoqOriginProducer? value, Uint8List buf) { + if (value == null) { + buf[0] = 0; + return 1; + } + buf[0] = 1; + return FfiConverterMoqOriginProducer.write( + value, + Uint8List.view(buf.buffer, buf.offsetInBytes + 1), + ) + + 1; + } +} + +class FfiConverterOptionalMoqRequest { + static MoqRequest? lift(RustBuffer buf) { + return FfiConverterOptionalMoqRequest.read(buf.asUint8List()).value; + } + + static LiftRetVal read(Uint8List buf) { + if (ByteData.view(buf.buffer, buf.offsetInBytes).getInt8(0) == 0) { + return LiftRetVal(null, 1); + } + final result = FfiConverterMoqRequest.read( + Uint8List.view(buf.buffer, buf.offsetInBytes + 1), + ); + return LiftRetVal(result.value, result.bytesRead + 1); + } + + static int allocationSize([MoqRequest? value]) { + if (value == null) { + return 1; + } + return FfiConverterMoqRequest.allocationSize(value) + 1; + } + + static RustBuffer lower(MoqRequest? value) { + if (value == null) { + return toRustBuffer(Uint8List.fromList([0])); + } + final buf = Uint8List(FfiConverterOptionalMoqRequest.allocationSize(value)); + FfiConverterOptionalMoqRequest.write(value, buf); + return toRustBuffer(buf); + } + + static int write(MoqRequest? value, Uint8List buf) { + if (value == null) { + buf[0] = 0; + return 1; + } + buf[0] = 1; + return FfiConverterMoqRequest.write( + value, + Uint8List.view(buf.buffer, buf.offsetInBytes + 1), + ) + + 1; + } +} + +class FfiConverterOptionalMoqReservation { + static MoqReservation? lift(RustBuffer buf) { + return FfiConverterOptionalMoqReservation.read(buf.asUint8List()).value; + } + + static LiftRetVal read(Uint8List buf) { if (ByteData.view(buf.buffer, buf.offsetInBytes).getInt8(0) == 0) { return LiftRetVal(null, 1); } - final result = FfiConverterMoqMediaFrame.read( + final result = FfiConverterMoqReservation.read( Uint8List.view(buf.buffer, buf.offsetInBytes + 1), ); - return LiftRetVal(result.value, result.bytesRead + 1); + return LiftRetVal(result.value, result.bytesRead + 1); } - static int allocationSize([MoqMediaFrame? value]) { + static int allocationSize([MoqReservation? value]) { if (value == null) { return 1; } - return FfiConverterMoqMediaFrame.allocationSize(value) + 1; + return FfiConverterMoqReservation.allocationSize(value) + 1; } - static RustBuffer lower(MoqMediaFrame? value) { + static RustBuffer lower(MoqReservation? value) { if (value == null) { return toRustBuffer(Uint8List.fromList([0])); } final buf = Uint8List( - FfiConverterOptionalMoqMediaFrame.allocationSize(value), + FfiConverterOptionalMoqReservation.allocationSize(value), ); - FfiConverterOptionalMoqMediaFrame.write(value, buf); + FfiConverterOptionalMoqReservation.write(value, buf); return toRustBuffer(buf); } - static int write(MoqMediaFrame? value, Uint8List buf) { + static int write(MoqReservation? value, Uint8List buf) { if (value == null) { buf[0] = 0; return 1; } buf[0] = 1; - return FfiConverterMoqMediaFrame.write( + return FfiConverterMoqReservation.write( value, Uint8List.view(buf.buffer, buf.offsetInBytes + 1), ) + @@ -10392,46 +13167,46 @@ class FfiConverterOptionalMoqMediaFrame { } } -class FfiConverterOptionalMoqMediaTimebase { - static MoqMediaTimebase? lift(RustBuffer buf) { - return FfiConverterOptionalMoqMediaTimebase.read(buf.asUint8List()).value; +class FfiConverterOptionalMoqSubscription { + static MoqSubscription? lift(RustBuffer buf) { + return FfiConverterOptionalMoqSubscription.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { if (ByteData.view(buf.buffer, buf.offsetInBytes).getInt8(0) == 0) { return LiftRetVal(null, 1); } - final result = FfiConverterMoqMediaTimebase.read( + final result = FfiConverterMoqSubscription.read( Uint8List.view(buf.buffer, buf.offsetInBytes + 1), ); - return LiftRetVal(result.value, result.bytesRead + 1); + return LiftRetVal(result.value, result.bytesRead + 1); } - static int allocationSize([MoqMediaTimebase? value]) { + static int allocationSize([MoqSubscription? value]) { if (value == null) { return 1; } - return FfiConverterMoqMediaTimebase.allocationSize(value) + 1; + return FfiConverterMoqSubscription.allocationSize(value) + 1; } - static RustBuffer lower(MoqMediaTimebase? value) { + static RustBuffer lower(MoqSubscription? value) { if (value == null) { return toRustBuffer(Uint8List.fromList([0])); } final buf = Uint8List( - FfiConverterOptionalMoqMediaTimebase.allocationSize(value), + FfiConverterOptionalMoqSubscription.allocationSize(value), ); - FfiConverterOptionalMoqMediaTimebase.write(value, buf); + FfiConverterOptionalMoqSubscription.write(value, buf); return toRustBuffer(buf); } - static int write(MoqMediaTimebase? value, Uint8List buf) { + static int write(MoqSubscription? value, Uint8List buf) { if (value == null) { buf[0] = 0; return 1; } buf[0] = 1; - return FfiConverterMoqMediaTimebase.write( + return FfiConverterMoqSubscription.write( value, Uint8List.view(buf.buffer, buf.offsetInBytes + 1), ) + @@ -10439,46 +13214,46 @@ class FfiConverterOptionalMoqMediaTimebase { } } -class FfiConverterOptionalMoqOriginProducer { - static MoqOriginProducer? lift(RustBuffer buf) { - return FfiConverterOptionalMoqOriginProducer.read(buf.asUint8List()).value; +class FfiConverterOptionalMoqTrackInfo { + static MoqTrackInfo? lift(RustBuffer buf) { + return FfiConverterOptionalMoqTrackInfo.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { if (ByteData.view(buf.buffer, buf.offsetInBytes).getInt8(0) == 0) { return LiftRetVal(null, 1); } - final result = FfiConverterMoqOriginProducer.read( + final result = FfiConverterMoqTrackInfo.read( Uint8List.view(buf.buffer, buf.offsetInBytes + 1), ); - return LiftRetVal(result.value, result.bytesRead + 1); + return LiftRetVal(result.value, result.bytesRead + 1); } - static int allocationSize([MoqOriginProducer? value]) { + static int allocationSize([MoqTrackInfo? value]) { if (value == null) { return 1; } - return FfiConverterMoqOriginProducer.allocationSize(value) + 1; + return FfiConverterMoqTrackInfo.allocationSize(value) + 1; } - static RustBuffer lower(MoqOriginProducer? value) { + static RustBuffer lower(MoqTrackInfo? value) { if (value == null) { return toRustBuffer(Uint8List.fromList([0])); } final buf = Uint8List( - FfiConverterOptionalMoqOriginProducer.allocationSize(value), + FfiConverterOptionalMoqTrackInfo.allocationSize(value), ); - FfiConverterOptionalMoqOriginProducer.write(value, buf); + FfiConverterOptionalMoqTrackInfo.write(value, buf); return toRustBuffer(buf); } - static int write(MoqOriginProducer? value, Uint8List buf) { + static int write(MoqTrackInfo? value, Uint8List buf) { if (value == null) { buf[0] = 0; return 1; } buf[0] = 1; - return FfiConverterMoqOriginProducer.write( + return FfiConverterMoqTrackInfo.write( value, Uint8List.view(buf.buffer, buf.offsetInBytes + 1), ) + @@ -10486,44 +13261,51 @@ class FfiConverterOptionalMoqOriginProducer { } } -class FfiConverterOptionalMoqRequest { - static MoqRequest? lift(RustBuffer buf) { - return FfiConverterOptionalMoqRequest.read(buf.asUint8List()).value; +class FfiConverterOptionalMoqVideoDecodedFrame { + static MoqVideoDecodedFrame? lift(RustBuffer buf) { + return FfiConverterOptionalMoqVideoDecodedFrame.read( + buf.asUint8List(), + ).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { if (ByteData.view(buf.buffer, buf.offsetInBytes).getInt8(0) == 0) { return LiftRetVal(null, 1); } - final result = FfiConverterMoqRequest.read( + final result = FfiConverterMoqVideoDecodedFrame.read( Uint8List.view(buf.buffer, buf.offsetInBytes + 1), ); - return LiftRetVal(result.value, result.bytesRead + 1); + return LiftRetVal( + result.value, + result.bytesRead + 1, + ); } - static int allocationSize([MoqRequest? value]) { + static int allocationSize([MoqVideoDecodedFrame? value]) { if (value == null) { return 1; } - return FfiConverterMoqRequest.allocationSize(value) + 1; + return FfiConverterMoqVideoDecodedFrame.allocationSize(value) + 1; } - static RustBuffer lower(MoqRequest? value) { + static RustBuffer lower(MoqVideoDecodedFrame? value) { if (value == null) { return toRustBuffer(Uint8List.fromList([0])); } - final buf = Uint8List(FfiConverterOptionalMoqRequest.allocationSize(value)); - FfiConverterOptionalMoqRequest.write(value, buf); + final buf = Uint8List( + FfiConverterOptionalMoqVideoDecodedFrame.allocationSize(value), + ); + FfiConverterOptionalMoqVideoDecodedFrame.write(value, buf); return toRustBuffer(buf); } - static int write(MoqRequest? value, Uint8List buf) { + static int write(MoqVideoDecodedFrame? value, Uint8List buf) { if (value == null) { buf[0] = 0; return 1; } buf[0] = 1; - return FfiConverterMoqRequest.write( + return FfiConverterMoqVideoDecodedFrame.write( value, Uint8List.view(buf.buffer, buf.offsetInBytes + 1), ) + @@ -10531,46 +13313,46 @@ class FfiConverterOptionalMoqRequest { } } -class FfiConverterOptionalMoqSubscription { - static MoqSubscription? lift(RustBuffer buf) { - return FfiConverterOptionalMoqSubscription.read(buf.asUint8List()).value; +class FfiConverterOptionalMoqVideoGop { + static MoqVideoGop? lift(RustBuffer buf) { + return FfiConverterOptionalMoqVideoGop.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { if (ByteData.view(buf.buffer, buf.offsetInBytes).getInt8(0) == 0) { return LiftRetVal(null, 1); } - final result = FfiConverterMoqSubscription.read( + final result = FfiConverterMoqVideoGop.read( Uint8List.view(buf.buffer, buf.offsetInBytes + 1), ); - return LiftRetVal(result.value, result.bytesRead + 1); + return LiftRetVal(result.value, result.bytesRead + 1); } - static int allocationSize([MoqSubscription? value]) { + static int allocationSize([MoqVideoGop? value]) { if (value == null) { return 1; } - return FfiConverterMoqSubscription.allocationSize(value) + 1; + return FfiConverterMoqVideoGop.allocationSize(value) + 1; } - static RustBuffer lower(MoqSubscription? value) { + static RustBuffer lower(MoqVideoGop? value) { if (value == null) { return toRustBuffer(Uint8List.fromList([0])); } final buf = Uint8List( - FfiConverterOptionalMoqSubscription.allocationSize(value), + FfiConverterOptionalMoqVideoGop.allocationSize(value), ); - FfiConverterOptionalMoqSubscription.write(value, buf); + FfiConverterOptionalMoqVideoGop.write(value, buf); return toRustBuffer(buf); } - static int write(MoqSubscription? value, Uint8List buf) { + static int write(MoqVideoGop? value, Uint8List buf) { if (value == null) { buf[0] = 0; return 1; } buf[0] = 1; - return FfiConverterMoqSubscription.write( + return FfiConverterMoqVideoGop.write( value, Uint8List.view(buf.buffer, buf.offsetInBytes + 1), ) + @@ -10578,46 +13360,46 @@ class FfiConverterOptionalMoqSubscription { } } -class FfiConverterOptionalMoqTrackInfo { - static MoqTrackInfo? lift(RustBuffer buf) { - return FfiConverterOptionalMoqTrackInfo.read(buf.asUint8List()).value; +class FfiConverterOptionalMoqVideoHint { + static MoqVideoHint? lift(RustBuffer buf) { + return FfiConverterOptionalMoqVideoHint.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { if (ByteData.view(buf.buffer, buf.offsetInBytes).getInt8(0) == 0) { return LiftRetVal(null, 1); } - final result = FfiConverterMoqTrackInfo.read( + final result = FfiConverterMoqVideoHint.read( Uint8List.view(buf.buffer, buf.offsetInBytes + 1), ); - return LiftRetVal(result.value, result.bytesRead + 1); + return LiftRetVal(result.value, result.bytesRead + 1); } - static int allocationSize([MoqTrackInfo? value]) { + static int allocationSize([MoqVideoHint? value]) { if (value == null) { return 1; } - return FfiConverterMoqTrackInfo.allocationSize(value) + 1; + return FfiConverterMoqVideoHint.allocationSize(value) + 1; } - static RustBuffer lower(MoqTrackInfo? value) { + static RustBuffer lower(MoqVideoHint? value) { if (value == null) { return toRustBuffer(Uint8List.fromList([0])); } final buf = Uint8List( - FfiConverterOptionalMoqTrackInfo.allocationSize(value), + FfiConverterOptionalMoqVideoHint.allocationSize(value), ); - FfiConverterOptionalMoqTrackInfo.write(value, buf); + FfiConverterOptionalMoqVideoHint.write(value, buf); return toRustBuffer(buf); } - static int write(MoqTrackInfo? value, Uint8List buf) { + static int write(MoqVideoHint? value, Uint8List buf) { if (value == null) { buf[0] = 0; return 1; } buf[0] = 1; - return FfiConverterMoqTrackInfo.write( + return FfiConverterMoqVideoHint.write( value, Uint8List.view(buf.buffer, buf.offsetInBytes + 1), ) + @@ -10625,46 +13407,46 @@ class FfiConverterOptionalMoqTrackInfo { } } -class FfiConverterOptionalMoqVideoHint { - static MoqVideoHint? lift(RustBuffer buf) { - return FfiConverterOptionalMoqVideoHint.read(buf.asUint8List()).value; +class FfiConverterOptionalMoqVideoSurface { + static MoqVideoSurface? lift(RustBuffer buf) { + return FfiConverterOptionalMoqVideoSurface.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { if (ByteData.view(buf.buffer, buf.offsetInBytes).getInt8(0) == 0) { return LiftRetVal(null, 1); } - final result = FfiConverterMoqVideoHint.read( + final result = FfiConverterMoqVideoSurface.read( Uint8List.view(buf.buffer, buf.offsetInBytes + 1), ); - return LiftRetVal(result.value, result.bytesRead + 1); + return LiftRetVal(result.value, result.bytesRead + 1); } - static int allocationSize([MoqVideoHint? value]) { + static int allocationSize([MoqVideoSurface? value]) { if (value == null) { return 1; } - return FfiConverterMoqVideoHint.allocationSize(value) + 1; + return FfiConverterMoqVideoSurface.allocationSize(value) + 1; } - static RustBuffer lower(MoqVideoHint? value) { + static RustBuffer lower(MoqVideoSurface? value) { if (value == null) { return toRustBuffer(Uint8List.fromList([0])); } final buf = Uint8List( - FfiConverterOptionalMoqVideoHint.allocationSize(value), + FfiConverterOptionalMoqVideoSurface.allocationSize(value), ); - FfiConverterOptionalMoqVideoHint.write(value, buf); + FfiConverterOptionalMoqVideoSurface.write(value, buf); return toRustBuffer(buf); } - static int write(MoqVideoHint? value, Uint8List buf) { + static int write(MoqVideoSurface? value, Uint8List buf) { if (value == null) { buf[0] = 0; return 1; } buf[0] = 1; - return FfiConverterMoqVideoHint.write( + return FfiConverterMoqVideoSurface.write( value, Uint8List.view(buf.buffer, buf.offsetInBytes + 1), ) + @@ -10831,71 +13613,204 @@ class FfiConverterOptionalUInt64 { return FfiConverterUInt64.allocationSize(value) + 1; } - static RustBuffer lower(int? value) { - if (value == null) { - return toRustBuffer(Uint8List.fromList([0])); - } - final buf = Uint8List(FfiConverterOptionalUInt64.allocationSize(value)); - FfiConverterOptionalUInt64.write(value, buf); - return toRustBuffer(buf); + static RustBuffer lower(int? value) { + if (value == null) { + return toRustBuffer(Uint8List.fromList([0])); + } + final buf = Uint8List(FfiConverterOptionalUInt64.allocationSize(value)); + FfiConverterOptionalUInt64.write(value, buf); + return toRustBuffer(buf); + } + + static int write(int? value, Uint8List buf) { + if (value == null) { + buf[0] = 0; + return 1; + } + buf[0] = 1; + return FfiConverterUInt64.write( + value, + Uint8List.view(buf.buffer, buf.offsetInBytes + 1), + ) + + 1; + } +} + +class FfiConverterOptionalUint8List { + static Uint8List? lift(RustBuffer buf) { + return FfiConverterOptionalUint8List.read(buf.asUint8List()).value; + } + + static LiftRetVal read(Uint8List buf) { + if (ByteData.view(buf.buffer, buf.offsetInBytes).getInt8(0) == 0) { + return LiftRetVal(null, 1); + } + final result = FfiConverterUint8List.read( + Uint8List.view(buf.buffer, buf.offsetInBytes + 1), + ); + return LiftRetVal(result.value, result.bytesRead + 1); + } + + static int allocationSize([Uint8List? value]) { + if (value == null) { + return 1; + } + return FfiConverterUint8List.allocationSize(value) + 1; + } + + static RustBuffer lower(Uint8List? value) { + if (value == null) { + return toRustBuffer(Uint8List.fromList([0])); + } + final buf = Uint8List(FfiConverterOptionalUint8List.allocationSize(value)); + FfiConverterOptionalUint8List.write(value, buf); + return toRustBuffer(buf); + } + + static int write(Uint8List? value, Uint8List buf) { + if (value == null) { + buf[0] = 0; + return 1; + } + buf[0] = 1; + return FfiConverterUint8List.write( + value, + Uint8List.view(buf.buffer, buf.offsetInBytes + 1), + ) + + 1; + } +} + +class FfiConverterSequenceDouble32 { + static List lift(RustBuffer buf) { + return FfiConverterSequenceDouble32.read(buf.asUint8List()).value; + } + + static LiftRetVal> read(Uint8List buf) { + List res = []; + final length = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); + int offset = buf.offsetInBytes + 4; + for (var i = 0; i < length; i++) { + final ret = FfiConverterDouble32.read(Uint8List.view(buf.buffer, offset)); + offset += ret.bytesRead; + res.add(ret.value); + } + return LiftRetVal(res, offset - buf.offsetInBytes); + } + + static int write(List value, Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, value.length); + int offset = buf.offsetInBytes + 4; + for (var i = 0; i < value.length; i++) { + offset += FfiConverterDouble32.write( + value[i], + Uint8List.view(buf.buffer, offset), + ); + } + return offset - buf.offsetInBytes; + } + + static int allocationSize(List value) { + return value + .map((l) => FfiConverterDouble32.allocationSize(l)) + .fold(0, (a, b) => a + b) + + 4; + } + + static RustBuffer lower(List value) { + final buf = Uint8List(allocationSize(value)); + write(value, buf); + return toRustBuffer(buf); + } +} + +class FfiConverterSequenceMoqAudioPacket { + static List lift(RustBuffer buf) { + return FfiConverterSequenceMoqAudioPacket.read(buf.asUint8List()).value; + } + + static LiftRetVal> read(Uint8List buf) { + List res = []; + final length = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); + int offset = buf.offsetInBytes + 4; + for (var i = 0; i < length; i++) { + final ret = FfiConverterMoqAudioPacket.read( + Uint8List.view(buf.buffer, offset), + ); + offset += ret.bytesRead; + res.add(ret.value); + } + return LiftRetVal(res, offset - buf.offsetInBytes); + } + + static int write(List value, Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, value.length); + int offset = buf.offsetInBytes + 4; + for (var i = 0; i < value.length; i++) { + offset += FfiConverterMoqAudioPacket.write( + value[i], + Uint8List.view(buf.buffer, offset), + ); + } + return offset - buf.offsetInBytes; + } + + static int allocationSize(List value) { + return value + .map((l) => FfiConverterMoqAudioPacket.allocationSize(l)) + .fold(0, (a, b) => a + b) + + 4; } - static int write(int? value, Uint8List buf) { - if (value == null) { - buf[0] = 0; - return 1; - } - buf[0] = 1; - return FfiConverterUInt64.write( - value, - Uint8List.view(buf.buffer, buf.offsetInBytes + 1), - ) + - 1; + static RustBuffer lower(List value) { + final buf = Uint8List(allocationSize(value)); + write(value, buf); + return toRustBuffer(buf); } } -class FfiConverterOptionalUint8List { - static Uint8List? lift(RustBuffer buf) { - return FfiConverterOptionalUint8List.read(buf.asUint8List()).value; +class FfiConverterSequenceMoqVideoPacket { + static List lift(RustBuffer buf) { + return FfiConverterSequenceMoqVideoPacket.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { - if (ByteData.view(buf.buffer, buf.offsetInBytes).getInt8(0) == 0) { - return LiftRetVal(null, 1); + static LiftRetVal> read(Uint8List buf) { + List res = []; + final length = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); + int offset = buf.offsetInBytes + 4; + for (var i = 0; i < length; i++) { + final ret = FfiConverterMoqVideoPacket.read( + Uint8List.view(buf.buffer, offset), + ); + offset += ret.bytesRead; + res.add(ret.value); } - final result = FfiConverterUint8List.read( - Uint8List.view(buf.buffer, buf.offsetInBytes + 1), - ); - return LiftRetVal(result.value, result.bytesRead + 1); + return LiftRetVal(res, offset - buf.offsetInBytes); } - static int allocationSize([Uint8List? value]) { - if (value == null) { - return 1; + static int write(List value, Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, value.length); + int offset = buf.offsetInBytes + 4; + for (var i = 0; i < value.length; i++) { + offset += FfiConverterMoqVideoPacket.write( + value[i], + Uint8List.view(buf.buffer, offset), + ); } - return FfiConverterUint8List.allocationSize(value) + 1; + return offset - buf.offsetInBytes; } - static RustBuffer lower(Uint8List? value) { - if (value == null) { - return toRustBuffer(Uint8List.fromList([0])); - } - final buf = Uint8List(FfiConverterOptionalUint8List.allocationSize(value)); - FfiConverterOptionalUint8List.write(value, buf); - return toRustBuffer(buf); + static int allocationSize(List value) { + return value + .map((l) => FfiConverterMoqVideoPacket.allocationSize(l)) + .fold(0, (a, b) => a + b) + + 4; } - static int write(Uint8List? value, Uint8List buf) { - if (value == null) { - buf[0] = 0; - return 1; - } - buf[0] = 1; - return FfiConverterUint8List.write( - value, - Uint8List.view(buf.buffer, buf.offsetInBytes + 1), - ) + - 1; + static RustBuffer lower(List value) { + final buf = Uint8List(allocationSize(value)); + write(value, buf); + return toRustBuffer(buf); } } @@ -11101,41 +14016,251 @@ class FfiConverterUint8List { return 4 + value.length; } - static int write(Uint8List value, Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, value.length); - buf.setRange(4, 4 + value.length, value); - return 4 + value.length; - } -} + static int write(Uint8List value, Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, value.length); + buf.setRange(4, 4 + value.length, value); + return 4 + value.length; + } +} + +const _uniffiAssetId = "package:moq_ffi/uniffi:moq_ffi"; +void moqLogLevel({required String level}) { + return rustCall((status) { + uniffi_moq_ffi_fn_func_moq_log_level( + FfiConverterString.lower(level), + status, + ); + }, moqExceptionErrorHandler); +} + +int moqEpochTimeMs({required String epoch}) { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_func_moq_epoch_time_ms( + FfiConverterString.lower(epoch), + status, + ), + FfiConverterUInt64.lift, + moqExceptionErrorHandler, + ); +} + +String moqMintEpoch() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_func_moq_mint_epoch(status), + FfiConverterString.lift, + null, + ); +} + +@Native Function(Pointer, Pointer)>( + assetId: _uniffiAssetId, +) +external Pointer uniffi_moq_ffi_fn_clone_moqaudiocodec( + Pointer handle, + Pointer uniffiStatus, +); + +@Native, Pointer)>( + assetId: _uniffiAssetId, +) +external void uniffi_moq_ffi_fn_free_moqaudiocodec( + Pointer handle, + Pointer uniffiStatus, +); + +@Native Function(Pointer)>( + assetId: _uniffiAssetId, +) +external Pointer uniffi_moq_ffi_fn_constructor_moqaudiocodec_aac( + Pointer uniffiStatus, +); + +@Native Function(Pointer)>( + assetId: _uniffiAssetId, +) +external Pointer uniffi_moq_ffi_fn_constructor_moqaudiocodec_opus( + Pointer uniffiStatus, +); + +@Native Function(Pointer, Pointer)>( + assetId: _uniffiAssetId, +) +external Pointer uniffi_moq_ffi_fn_clone_moqaudioconsumer( + Pointer handle, + Pointer uniffiStatus, +); + +@Native, Pointer)>( + assetId: _uniffiAssetId, +) +external void uniffi_moq_ffi_fn_free_moqaudioconsumer( + Pointer handle, + Pointer uniffiStatus, +); + +@Native< + Pointer Function(Pointer, RustBuffer, RustBuffer, RustBuffer) +>(assetId: _uniffiAssetId) +external Pointer uniffi_moq_ffi_fn_constructor_moqaudioconsumer_subscribe( + Pointer broadcast, + RustBuffer id, + RustBuffer catalog_audio, + RustBuffer output, +); + +@Native, Pointer)>( + assetId: _uniffiAssetId, +) +external void uniffi_moq_ffi_fn_method_moqaudioconsumer_cancel( + Pointer ptr, + Pointer uniffiStatus, +); + +@Native Function(Pointer)>(assetId: _uniffiAssetId) +external Pointer uniffi_moq_ffi_fn_method_moqaudioconsumer_next( + Pointer ptr, +); + +@Native Function(Pointer, Pointer)>( + assetId: _uniffiAssetId, +) +external Pointer uniffi_moq_ffi_fn_clone_moqaudioencoder( + Pointer handle, + Pointer uniffiStatus, +); + +@Native, Pointer)>( + assetId: _uniffiAssetId, +) +external void uniffi_moq_ffi_fn_free_moqaudioencoder( + Pointer handle, + Pointer uniffiStatus, +); + +@Native Function(RustBuffer, Pointer)>( + assetId: _uniffiAssetId, +) +external Pointer uniffi_moq_ffi_fn_constructor_moqaudioencoder_new( + RustBuffer output, + Pointer uniffiStatus, +); + +@Native< + RustBuffer Function(Pointer, RustBuffer, Pointer) +>(assetId: _uniffiAssetId) +external RustBuffer uniffi_moq_ffi_fn_method_moqaudioencoder_encode( + Pointer ptr, + RustBuffer pcm, + Pointer uniffiStatus, +); + +@Native< + RustBuffer Function(Pointer, RustBuffer, Pointer) +>(assetId: _uniffiAssetId) +external RustBuffer uniffi_moq_ffi_fn_method_moqaudioencoder_finish( + Pointer ptr, + RustBuffer pcm, + Pointer uniffiStatus, +); + +@Native, Pointer)>( + assetId: _uniffiAssetId, +) +external int uniffi_moq_ffi_fn_method_moqaudioencoder_frame_size( + Pointer ptr, + Pointer uniffiStatus, +); + +@Native, Uint64, Pointer)>( + assetId: _uniffiAssetId, +) +external void uniffi_moq_ffi_fn_method_moqaudioencoder_set_bitrate( + Pointer ptr, + int bitrate, + Pointer uniffiStatus, +); + +@Native, Pointer)>( + assetId: _uniffiAssetId, +) +external RustBuffer uniffi_moq_ffi_fn_method_moqaudioencoder_track_init( + Pointer ptr, + Pointer uniffiStatus, +); + +@Native Function(Pointer, Pointer)>( + assetId: _uniffiAssetId, +) +external Pointer uniffi_moq_ffi_fn_clone_moqaudioproducer( + Pointer handle, + Pointer uniffiStatus, +); + +@Native, Pointer)>( + assetId: _uniffiAssetId, +) +external void uniffi_moq_ffi_fn_free_moqaudioproducer( + Pointer handle, + Pointer uniffiStatus, +); + +@Native< + Pointer Function( + Pointer, + RustBuffer, + RustBuffer, + RustBuffer, + Pointer, + ) +>(assetId: _uniffiAssetId) +external Pointer uniffi_moq_ffi_fn_constructor_moqaudioproducer_new( + Pointer catalog, + RustBuffer input, + RustBuffer output, + RustBuffer bandwidth, + Pointer uniffiStatus, +); + +@Native Function(Pointer, Pointer)>( + assetId: _uniffiAssetId, +) +external Pointer uniffi_moq_ffi_fn_method_moqaudioproducer_demand( + Pointer ptr, + Pointer uniffiStatus, +); + +@Native, Pointer)>( + assetId: _uniffiAssetId, +) +external void uniffi_moq_ffi_fn_method_moqaudioproducer_finish( + Pointer ptr, + Pointer uniffiStatus, +); -const _uniffiAssetId = "package:moq_ffi/uniffi:moq_ffi"; -void moqLogLevel({required String level}) { - return rustCall((status) { - uniffi_moq_ffi_fn_func_moq_log_level( - FfiConverterString.lower(level), - status, - ); - }, moqExceptionErrorHandler); -} +@Native, Pointer)>( + assetId: _uniffiAssetId, +) +external void uniffi_moq_ffi_fn_method_moqaudioproducer_reanchor( + Pointer ptr, + Pointer uniffiStatus, +); -int moqEpochTimeMs({required String epoch}) { - return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_func_moq_epoch_time_ms( - FfiConverterString.lower(epoch), - status, - ), - FfiConverterUInt64.lift, - moqExceptionErrorHandler, - ); -} +@Native, Pointer)>( + assetId: _uniffiAssetId, +) +external RustBuffer uniffi_moq_ffi_fn_method_moqaudioproducer_reservation( + Pointer ptr, + Pointer uniffiStatus, +); -String moqMintEpoch() { - return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_func_moq_mint_epoch(status), - FfiConverterString.lift, - null, - ); -} +@Native, RustBuffer, Pointer)>( + assetId: _uniffiAssetId, +) +external void uniffi_moq_ffi_fn_method_moqaudioproducer_write( + Pointer ptr, + RustBuffer frame, + Pointer uniffiStatus, +); @Native Function(Pointer, Pointer)>( assetId: _uniffiAssetId, @@ -12921,13 +16046,222 @@ external RustBuffer uniffi_moq_ffi_fn_method_moqrequest_transport( ) external RustBuffer uniffi_moq_ffi_fn_method_moqrequest_url( Pointer ptr, - Pointer uniffiStatus, + Pointer uniffiStatus, +); + +@Native Function(Pointer, Pointer)>( + assetId: _uniffiAssetId, +) +external Pointer uniffi_moq_ffi_fn_clone_moqserver( + Pointer handle, + Pointer uniffiStatus, +); + +@Native, Pointer)>( + assetId: _uniffiAssetId, +) +external void uniffi_moq_ffi_fn_free_moqserver( + Pointer handle, + Pointer uniffiStatus, +); + +@Native Function(RustBuffer, Pointer)>( + assetId: _uniffiAssetId, +) +external Pointer uniffi_moq_ffi_fn_constructor_moqserver_new( + RustBuffer config, + Pointer uniffiStatus, +); + +@Native Function(Pointer)>(assetId: _uniffiAssetId) +external Pointer uniffi_moq_ffi_fn_method_moqserver_accept( + Pointer ptr, +); + +@Native, Pointer)>( + assetId: _uniffiAssetId, +) +external void uniffi_moq_ffi_fn_method_moqserver_cancel( + Pointer ptr, + Pointer uniffiStatus, +); + +@Native, Pointer)>( + assetId: _uniffiAssetId, +) +external RustBuffer uniffi_moq_ffi_fn_method_moqserver_cert_fingerprints( + Pointer ptr, + Pointer uniffiStatus, +); + +@Native Function(Pointer)>(assetId: _uniffiAssetId) +external Pointer uniffi_moq_ffi_fn_method_moqserver_listen( + Pointer ptr, +); + +@Native Function(Pointer, Pointer)>( + assetId: _uniffiAssetId, +) +external Pointer uniffi_moq_ffi_fn_clone_moqclient( + Pointer handle, + Pointer uniffiStatus, +); + +@Native, Pointer)>( + assetId: _uniffiAssetId, +) +external void uniffi_moq_ffi_fn_free_moqclient( + Pointer handle, + Pointer uniffiStatus, +); + +@Native Function(RustBuffer, Pointer)>( + assetId: _uniffiAssetId, +) +external Pointer uniffi_moq_ffi_fn_constructor_moqclient_new( + RustBuffer config, + Pointer uniffiStatus, +); + +@Native, Pointer)>( + assetId: _uniffiAssetId, +) +external void uniffi_moq_ffi_fn_method_moqclient_cancel( + Pointer ptr, + Pointer uniffiStatus, +); + +@Native Function(Pointer, RustBuffer)>( + assetId: _uniffiAssetId, +) +external Pointer uniffi_moq_ffi_fn_method_moqclient_connect( + Pointer ptr, + RustBuffer url, +); + +@Native Function(Pointer, Pointer)>( + assetId: _uniffiAssetId, +) +external Pointer uniffi_moq_ffi_fn_clone_moqsession( + Pointer handle, + Pointer uniffiStatus, +); + +@Native, Pointer)>( + assetId: _uniffiAssetId, +) +external void uniffi_moq_ffi_fn_free_moqsession( + Pointer handle, + Pointer uniffiStatus, +); + +@Native Function(Pointer, Pointer)>( + assetId: _uniffiAssetId, +) +external Pointer uniffi_moq_ffi_fn_method_moqsession_bandwidth( + Pointer ptr, + Pointer uniffiStatus, +); + +@Native, Uint32, Pointer)>( + assetId: _uniffiAssetId, +) +external void uniffi_moq_ffi_fn_method_moqsession_cancel( + Pointer ptr, + int code, + Pointer uniffiStatus, +); + +@Native Function(Pointer)>(assetId: _uniffiAssetId) +external Pointer uniffi_moq_ffi_fn_method_moqsession_closed( + Pointer ptr, +); + +@Native, Pointer)>( + assetId: _uniffiAssetId, +) +external int uniffi_moq_ffi_fn_method_moqsession_connects( + Pointer ptr, + Pointer uniffiStatus, +); + +@Native Function(Pointer, Pointer)>( + assetId: _uniffiAssetId, +) +external Pointer uniffi_moq_ffi_fn_method_moqsession_consume( + Pointer ptr, + Pointer uniffiStatus, +); + +@Native Function(Pointer, Pointer)>( + assetId: _uniffiAssetId, +) +external Pointer uniffi_moq_ffi_fn_method_moqsession_publish( + Pointer ptr, + Pointer uniffiStatus, +); + +@Native Function(Pointer)>(assetId: _uniffiAssetId) +external Pointer uniffi_moq_ffi_fn_method_moqsession_shutdown( + Pointer ptr, +); + +@Native, Pointer)>( + assetId: _uniffiAssetId, +) +external RustBuffer uniffi_moq_ffi_fn_method_moqsession_stats( + Pointer ptr, + Pointer uniffiStatus, +); + +@Native Function(Pointer)>(assetId: _uniffiAssetId) +external Pointer uniffi_moq_ffi_fn_method_moqsession_status( + Pointer ptr, +); + +@Native Function(Pointer, Pointer)>( + assetId: _uniffiAssetId, +) +external Pointer uniffi_moq_ffi_fn_clone_moqvideoconsumer( + Pointer handle, + Pointer uniffiStatus, +); + +@Native, Pointer)>( + assetId: _uniffiAssetId, +) +external void uniffi_moq_ffi_fn_free_moqvideoconsumer( + Pointer handle, + Pointer uniffiStatus, +); + +@Native< + Pointer Function(Pointer, RustBuffer, RustBuffer, RustBuffer) +>(assetId: _uniffiAssetId) +external Pointer uniffi_moq_ffi_fn_constructor_moqvideoconsumer_subscribe( + Pointer broadcast, + RustBuffer id, + RustBuffer catalog_video, + RustBuffer output, +); + +@Native, Pointer)>( + assetId: _uniffiAssetId, +) +external void uniffi_moq_ffi_fn_method_moqvideoconsumer_cancel( + Pointer ptr, + Pointer uniffiStatus, +); + +@Native Function(Pointer)>(assetId: _uniffiAssetId) +external Pointer uniffi_moq_ffi_fn_method_moqvideoconsumer_next( + Pointer ptr, ); @Native Function(Pointer, Pointer)>( assetId: _uniffiAssetId, ) -external Pointer uniffi_moq_ffi_fn_clone_moqserver( +external Pointer uniffi_moq_ffi_fn_clone_moqvideodecodedframe( Pointer handle, Pointer uniffiStatus, ); @@ -12935,49 +16269,56 @@ external Pointer uniffi_moq_ffi_fn_clone_moqserver( @Native, Pointer)>( assetId: _uniffiAssetId, ) -external void uniffi_moq_ffi_fn_free_moqserver( +external void uniffi_moq_ffi_fn_free_moqvideodecodedframe( Pointer handle, Pointer uniffiStatus, ); -@Native Function(RustBuffer, Pointer)>( +@Native, Pointer)>( assetId: _uniffiAssetId, ) -external Pointer uniffi_moq_ffi_fn_constructor_moqserver_new( - RustBuffer config, +external int uniffi_moq_ffi_fn_method_moqvideodecodedframe_height( + Pointer ptr, Pointer uniffiStatus, ); -@Native Function(Pointer)>(assetId: _uniffiAssetId) -external Pointer uniffi_moq_ffi_fn_method_moqserver_accept( +@Native< + RustBuffer Function(Pointer, RustBuffer, Pointer) +>(assetId: _uniffiAssetId) +external RustBuffer uniffi_moq_ffi_fn_method_moqvideodecodedframe_pixels( Pointer ptr, + RustBuffer format, + Pointer uniffiStatus, ); -@Native, Pointer)>( +@Native, Pointer)>( assetId: _uniffiAssetId, ) -external void uniffi_moq_ffi_fn_method_moqserver_cancel( +external RustBuffer uniffi_moq_ffi_fn_method_moqvideodecodedframe_surface( Pointer ptr, Pointer uniffiStatus, ); -@Native, Pointer)>( +@Native, Pointer)>( assetId: _uniffiAssetId, ) -external RustBuffer uniffi_moq_ffi_fn_method_moqserver_cert_fingerprints( +external int uniffi_moq_ffi_fn_method_moqvideodecodedframe_timestamp_us( Pointer ptr, Pointer uniffiStatus, ); -@Native Function(Pointer)>(assetId: _uniffiAssetId) -external Pointer uniffi_moq_ffi_fn_method_moqserver_listen( +@Native, Pointer)>( + assetId: _uniffiAssetId, +) +external int uniffi_moq_ffi_fn_method_moqvideodecodedframe_width( Pointer ptr, + Pointer uniffiStatus, ); @Native Function(Pointer, Pointer)>( assetId: _uniffiAssetId, ) -external Pointer uniffi_moq_ffi_fn_clone_moqclient( +external Pointer uniffi_moq_ffi_fn_clone_moqvideoencoder( Pointer handle, Pointer uniffiStatus, ); @@ -12985,77 +16326,99 @@ external Pointer uniffi_moq_ffi_fn_clone_moqclient( @Native, Pointer)>( assetId: _uniffiAssetId, ) -external void uniffi_moq_ffi_fn_free_moqclient( +external void uniffi_moq_ffi_fn_free_moqvideoencoder( Pointer handle, Pointer uniffiStatus, ); -@Native Function(RustBuffer, Pointer)>( - assetId: _uniffiAssetId, -) -external Pointer uniffi_moq_ffi_fn_constructor_moqclient_new( - RustBuffer config, +@Native< + Pointer Function(RustBuffer, RustBuffer, Pointer) +>(assetId: _uniffiAssetId) +external Pointer uniffi_moq_ffi_fn_constructor_moqvideoencoder_new( + RustBuffer input, + RustBuffer output, Pointer uniffiStatus, ); @Native, Pointer)>( assetId: _uniffiAssetId, ) -external void uniffi_moq_ffi_fn_method_moqclient_cancel( +external void uniffi_moq_ffi_fn_method_moqvideoencoder_cut( Pointer ptr, Pointer uniffiStatus, ); -@Native Function(Pointer, RustBuffer)>( +@Native< + RustBuffer Function(Pointer, RustBuffer, Pointer) +>(assetId: _uniffiAssetId) +external RustBuffer uniffi_moq_ffi_fn_method_moqvideoencoder_encode( + Pointer ptr, + RustBuffer frame, + Pointer uniffiStatus, +); + +@Native, Pointer)>( assetId: _uniffiAssetId, ) -external Pointer uniffi_moq_ffi_fn_method_moqclient_connect( +external RustBuffer uniffi_moq_ffi_fn_method_moqvideoencoder_finish( Pointer ptr, - RustBuffer url, + Pointer uniffiStatus, ); -@Native Function(Pointer, Pointer)>( +@Native, Pointer)>( assetId: _uniffiAssetId, ) -external Pointer uniffi_moq_ffi_fn_clone_moqsession( - Pointer handle, +external RustBuffer uniffi_moq_ffi_fn_method_moqvideoencoder_flush( + Pointer ptr, Pointer uniffiStatus, ); -@Native, Pointer)>( +@Native, Uint64, Pointer)>( assetId: _uniffiAssetId, ) -external void uniffi_moq_ffi_fn_free_moqsession( - Pointer handle, +external void uniffi_moq_ffi_fn_method_moqvideoencoder_set_bitrate( + Pointer ptr, + int bitrate, Pointer uniffiStatus, ); @Native Function(Pointer, Pointer)>( assetId: _uniffiAssetId, ) -external Pointer uniffi_moq_ffi_fn_method_moqsession_bandwidth( - Pointer ptr, +external Pointer uniffi_moq_ffi_fn_clone_moqvideoproducer( + Pointer handle, Pointer uniffiStatus, ); -@Native, Uint32, Pointer)>( +@Native, Pointer)>( assetId: _uniffiAssetId, ) -external void uniffi_moq_ffi_fn_method_moqsession_cancel( - Pointer ptr, - int code, +external void uniffi_moq_ffi_fn_free_moqvideoproducer( + Pointer handle, Pointer uniffiStatus, ); -@Native Function(Pointer)>(assetId: _uniffiAssetId) -external Pointer uniffi_moq_ffi_fn_method_moqsession_closed( - Pointer ptr, +@Native< + Pointer Function( + Pointer, + RustBuffer, + RustBuffer, + RustBuffer, + Pointer, + ) +>(assetId: _uniffiAssetId) +external Pointer uniffi_moq_ffi_fn_constructor_moqvideoproducer_new( + Pointer catalog, + RustBuffer input, + RustBuffer output, + RustBuffer bandwidth, + Pointer uniffiStatus, ); -@Native, Pointer)>( +@Native, Pointer)>( assetId: _uniffiAssetId, ) -external int uniffi_moq_ffi_fn_method_moqsession_connects( +external void uniffi_moq_ffi_fn_method_moqvideoproducer_cut( Pointer ptr, Pointer uniffiStatus, ); @@ -13063,35 +16426,43 @@ external int uniffi_moq_ffi_fn_method_moqsession_connects( @Native Function(Pointer, Pointer)>( assetId: _uniffiAssetId, ) -external Pointer uniffi_moq_ffi_fn_method_moqsession_consume( +external Pointer uniffi_moq_ffi_fn_method_moqvideoproducer_demand( Pointer ptr, Pointer uniffiStatus, ); -@Native Function(Pointer, Pointer)>( +@Native, Pointer)>( assetId: _uniffiAssetId, ) -external Pointer uniffi_moq_ffi_fn_method_moqsession_publish( +external void uniffi_moq_ffi_fn_method_moqvideoproducer_finish( Pointer ptr, Pointer uniffiStatus, ); -@Native Function(Pointer)>(assetId: _uniffiAssetId) -external Pointer uniffi_moq_ffi_fn_method_moqsession_shutdown( +@Native, Pointer)>( + assetId: _uniffiAssetId, +) +external RustBuffer uniffi_moq_ffi_fn_method_moqvideoproducer_reservation( Pointer ptr, + Pointer uniffiStatus, ); -@Native, Pointer)>( +@Native, Uint64, Pointer)>( assetId: _uniffiAssetId, ) -external RustBuffer uniffi_moq_ffi_fn_method_moqsession_stats( +external void uniffi_moq_ffi_fn_method_moqvideoproducer_set_bitrate( Pointer ptr, + int bitrate, Pointer uniffiStatus, ); -@Native Function(Pointer)>(assetId: _uniffiAssetId) -external Pointer uniffi_moq_ffi_fn_method_moqsession_status( +@Native, RustBuffer, Pointer)>( + assetId: _uniffiAssetId, +) +external void uniffi_moq_ffi_fn_method_moqvideoproducer_write( Pointer ptr, + RustBuffer frame, + Pointer uniffiStatus, ); @Native)>( @@ -13456,6 +16827,42 @@ external int uniffi_moq_ffi_checksum_func_moq_epoch_time_ms(); @Native(assetId: _uniffiAssetId) external int uniffi_moq_ffi_checksum_func_moq_mint_epoch(); +@Native(assetId: _uniffiAssetId) +external int uniffi_moq_ffi_checksum_method_moqaudioconsumer_cancel(); + +@Native(assetId: _uniffiAssetId) +external int uniffi_moq_ffi_checksum_method_moqaudioconsumer_next(); + +@Native(assetId: _uniffiAssetId) +external int uniffi_moq_ffi_checksum_method_moqaudioencoder_encode(); + +@Native(assetId: _uniffiAssetId) +external int uniffi_moq_ffi_checksum_method_moqaudioencoder_finish(); + +@Native(assetId: _uniffiAssetId) +external int uniffi_moq_ffi_checksum_method_moqaudioencoder_frame_size(); + +@Native(assetId: _uniffiAssetId) +external int uniffi_moq_ffi_checksum_method_moqaudioencoder_set_bitrate(); + +@Native(assetId: _uniffiAssetId) +external int uniffi_moq_ffi_checksum_method_moqaudioencoder_track_init(); + +@Native(assetId: _uniffiAssetId) +external int uniffi_moq_ffi_checksum_method_moqaudioproducer_demand(); + +@Native(assetId: _uniffiAssetId) +external int uniffi_moq_ffi_checksum_method_moqaudioproducer_finish(); + +@Native(assetId: _uniffiAssetId) +external int uniffi_moq_ffi_checksum_method_moqaudioproducer_reanchor(); + +@Native(assetId: _uniffiAssetId) +external int uniffi_moq_ffi_checksum_method_moqaudioproducer_reservation(); + +@Native(assetId: _uniffiAssetId) +external int uniffi_moq_ffi_checksum_method_moqaudioproducer_write(); + @Native(assetId: _uniffiAssetId) external int uniffi_moq_ffi_checksum_method_moqbandwidth_reserve(); @@ -13885,6 +17292,75 @@ external int uniffi_moq_ffi_checksum_method_moqsession_stats(); @Native(assetId: _uniffiAssetId) external int uniffi_moq_ffi_checksum_method_moqsession_status(); +@Native(assetId: _uniffiAssetId) +external int uniffi_moq_ffi_checksum_method_moqvideoconsumer_cancel(); + +@Native(assetId: _uniffiAssetId) +external int uniffi_moq_ffi_checksum_method_moqvideoconsumer_next(); + +@Native(assetId: _uniffiAssetId) +external int uniffi_moq_ffi_checksum_method_moqvideodecodedframe_height(); + +@Native(assetId: _uniffiAssetId) +external int uniffi_moq_ffi_checksum_method_moqvideodecodedframe_pixels(); + +@Native(assetId: _uniffiAssetId) +external int uniffi_moq_ffi_checksum_method_moqvideodecodedframe_surface(); + +@Native(assetId: _uniffiAssetId) +external int uniffi_moq_ffi_checksum_method_moqvideodecodedframe_timestamp_us(); + +@Native(assetId: _uniffiAssetId) +external int uniffi_moq_ffi_checksum_method_moqvideodecodedframe_width(); + +@Native(assetId: _uniffiAssetId) +external int uniffi_moq_ffi_checksum_method_moqvideoencoder_cut(); + +@Native(assetId: _uniffiAssetId) +external int uniffi_moq_ffi_checksum_method_moqvideoencoder_encode(); + +@Native(assetId: _uniffiAssetId) +external int uniffi_moq_ffi_checksum_method_moqvideoencoder_finish(); + +@Native(assetId: _uniffiAssetId) +external int uniffi_moq_ffi_checksum_method_moqvideoencoder_flush(); + +@Native(assetId: _uniffiAssetId) +external int uniffi_moq_ffi_checksum_method_moqvideoencoder_set_bitrate(); + +@Native(assetId: _uniffiAssetId) +external int uniffi_moq_ffi_checksum_method_moqvideoproducer_cut(); + +@Native(assetId: _uniffiAssetId) +external int uniffi_moq_ffi_checksum_method_moqvideoproducer_demand(); + +@Native(assetId: _uniffiAssetId) +external int uniffi_moq_ffi_checksum_method_moqvideoproducer_finish(); + +@Native(assetId: _uniffiAssetId) +external int uniffi_moq_ffi_checksum_method_moqvideoproducer_reservation(); + +@Native(assetId: _uniffiAssetId) +external int uniffi_moq_ffi_checksum_method_moqvideoproducer_set_bitrate(); + +@Native(assetId: _uniffiAssetId) +external int uniffi_moq_ffi_checksum_method_moqvideoproducer_write(); + +@Native(assetId: _uniffiAssetId) +external int uniffi_moq_ffi_checksum_constructor_moqaudiocodec_aac(); + +@Native(assetId: _uniffiAssetId) +external int uniffi_moq_ffi_checksum_constructor_moqaudiocodec_opus(); + +@Native(assetId: _uniffiAssetId) +external int uniffi_moq_ffi_checksum_constructor_moqaudioconsumer_subscribe(); + +@Native(assetId: _uniffiAssetId) +external int uniffi_moq_ffi_checksum_constructor_moqaudioencoder_new(); + +@Native(assetId: _uniffiAssetId) +external int uniffi_moq_ffi_checksum_constructor_moqaudioproducer_new(); + @Native(assetId: _uniffiAssetId) external int uniffi_moq_ffi_checksum_constructor_moqflatesnapshotproducer_new(); @@ -13953,6 +17429,15 @@ external int uniffi_moq_ffi_checksum_constructor_moqserver_new(); @Native(assetId: _uniffiAssetId) external int uniffi_moq_ffi_checksum_constructor_moqclient_new(); +@Native(assetId: _uniffiAssetId) +external int uniffi_moq_ffi_checksum_constructor_moqvideoconsumer_subscribe(); + +@Native(assetId: _uniffiAssetId) +external int uniffi_moq_ffi_checksum_constructor_moqvideoencoder_new(); + +@Native(assetId: _uniffiAssetId) +external int uniffi_moq_ffi_checksum_constructor_moqvideoproducer_new(); + @Native(assetId: _uniffiAssetId) external int ffi_moq_ffi_uniffi_contract_version(); @@ -13976,6 +17461,42 @@ void _checkApiChecksums() { if (uniffi_moq_ffi_checksum_func_moq_mint_epoch() != 34550) { throw UniffiInternalError.panicked("UniFFI API checksum mismatch"); } + if (uniffi_moq_ffi_checksum_method_moqaudioconsumer_cancel() != 62285) { + throw UniffiInternalError.panicked("UniFFI API checksum mismatch"); + } + if (uniffi_moq_ffi_checksum_method_moqaudioconsumer_next() != 5941) { + throw UniffiInternalError.panicked("UniFFI API checksum mismatch"); + } + if (uniffi_moq_ffi_checksum_method_moqaudioencoder_encode() != 56589) { + throw UniffiInternalError.panicked("UniFFI API checksum mismatch"); + } + if (uniffi_moq_ffi_checksum_method_moqaudioencoder_finish() != 62112) { + throw UniffiInternalError.panicked("UniFFI API checksum mismatch"); + } + if (uniffi_moq_ffi_checksum_method_moqaudioencoder_frame_size() != 37264) { + throw UniffiInternalError.panicked("UniFFI API checksum mismatch"); + } + if (uniffi_moq_ffi_checksum_method_moqaudioencoder_set_bitrate() != 10667) { + throw UniffiInternalError.panicked("UniFFI API checksum mismatch"); + } + if (uniffi_moq_ffi_checksum_method_moqaudioencoder_track_init() != 56663) { + throw UniffiInternalError.panicked("UniFFI API checksum mismatch"); + } + if (uniffi_moq_ffi_checksum_method_moqaudioproducer_demand() != 42822) { + throw UniffiInternalError.panicked("UniFFI API checksum mismatch"); + } + if (uniffi_moq_ffi_checksum_method_moqaudioproducer_finish() != 6287) { + throw UniffiInternalError.panicked("UniFFI API checksum mismatch"); + } + if (uniffi_moq_ffi_checksum_method_moqaudioproducer_reanchor() != 34412) { + throw UniffiInternalError.panicked("UniFFI API checksum mismatch"); + } + if (uniffi_moq_ffi_checksum_method_moqaudioproducer_reservation() != 43848) { + throw UniffiInternalError.panicked("UniFFI API checksum mismatch"); + } + if (uniffi_moq_ffi_checksum_method_moqaudioproducer_write() != 22094) { + throw UniffiInternalError.panicked("UniFFI API checksum mismatch"); + } if (uniffi_moq_ffi_checksum_method_moqbandwidth_reserve() != 27807) { throw UniffiInternalError.panicked("UniFFI API checksum mismatch"); } @@ -14423,6 +17944,77 @@ void _checkApiChecksums() { if (uniffi_moq_ffi_checksum_method_moqsession_status() != 49725) { throw UniffiInternalError.panicked("UniFFI API checksum mismatch"); } + if (uniffi_moq_ffi_checksum_method_moqvideoconsumer_cancel() != 21122) { + throw UniffiInternalError.panicked("UniFFI API checksum mismatch"); + } + if (uniffi_moq_ffi_checksum_method_moqvideoconsumer_next() != 52826) { + throw UniffiInternalError.panicked("UniFFI API checksum mismatch"); + } + if (uniffi_moq_ffi_checksum_method_moqvideodecodedframe_height() != 7330) { + throw UniffiInternalError.panicked("UniFFI API checksum mismatch"); + } + if (uniffi_moq_ffi_checksum_method_moqvideodecodedframe_pixels() != 60854) { + throw UniffiInternalError.panicked("UniFFI API checksum mismatch"); + } + if (uniffi_moq_ffi_checksum_method_moqvideodecodedframe_surface() != 3872) { + throw UniffiInternalError.panicked("UniFFI API checksum mismatch"); + } + if (uniffi_moq_ffi_checksum_method_moqvideodecodedframe_timestamp_us() != + 18681) { + throw UniffiInternalError.panicked("UniFFI API checksum mismatch"); + } + if (uniffi_moq_ffi_checksum_method_moqvideodecodedframe_width() != 30916) { + throw UniffiInternalError.panicked("UniFFI API checksum mismatch"); + } + if (uniffi_moq_ffi_checksum_method_moqvideoencoder_cut() != 28527) { + throw UniffiInternalError.panicked("UniFFI API checksum mismatch"); + } + if (uniffi_moq_ffi_checksum_method_moqvideoencoder_encode() != 513) { + throw UniffiInternalError.panicked("UniFFI API checksum mismatch"); + } + if (uniffi_moq_ffi_checksum_method_moqvideoencoder_finish() != 5918) { + throw UniffiInternalError.panicked("UniFFI API checksum mismatch"); + } + if (uniffi_moq_ffi_checksum_method_moqvideoencoder_flush() != 4585) { + throw UniffiInternalError.panicked("UniFFI API checksum mismatch"); + } + if (uniffi_moq_ffi_checksum_method_moqvideoencoder_set_bitrate() != 34315) { + throw UniffiInternalError.panicked("UniFFI API checksum mismatch"); + } + if (uniffi_moq_ffi_checksum_method_moqvideoproducer_cut() != 18974) { + throw UniffiInternalError.panicked("UniFFI API checksum mismatch"); + } + if (uniffi_moq_ffi_checksum_method_moqvideoproducer_demand() != 283) { + throw UniffiInternalError.panicked("UniFFI API checksum mismatch"); + } + if (uniffi_moq_ffi_checksum_method_moqvideoproducer_finish() != 59081) { + throw UniffiInternalError.panicked("UniFFI API checksum mismatch"); + } + if (uniffi_moq_ffi_checksum_method_moqvideoproducer_reservation() != 64430) { + throw UniffiInternalError.panicked("UniFFI API checksum mismatch"); + } + if (uniffi_moq_ffi_checksum_method_moqvideoproducer_set_bitrate() != 28203) { + throw UniffiInternalError.panicked("UniFFI API checksum mismatch"); + } + if (uniffi_moq_ffi_checksum_method_moqvideoproducer_write() != 6141) { + throw UniffiInternalError.panicked("UniFFI API checksum mismatch"); + } + if (uniffi_moq_ffi_checksum_constructor_moqaudiocodec_aac() != 18170) { + throw UniffiInternalError.panicked("UniFFI API checksum mismatch"); + } + if (uniffi_moq_ffi_checksum_constructor_moqaudiocodec_opus() != 64803) { + throw UniffiInternalError.panicked("UniFFI API checksum mismatch"); + } + if (uniffi_moq_ffi_checksum_constructor_moqaudioconsumer_subscribe() != + 43304) { + throw UniffiInternalError.panicked("UniFFI API checksum mismatch"); + } + if (uniffi_moq_ffi_checksum_constructor_moqaudioencoder_new() != 52616) { + throw UniffiInternalError.panicked("UniFFI API checksum mismatch"); + } + if (uniffi_moq_ffi_checksum_constructor_moqaudioproducer_new() != 49804) { + throw UniffiInternalError.panicked("UniFFI API checksum mismatch"); + } if (uniffi_moq_ffi_checksum_constructor_moqflatesnapshotproducer_new() != 40377) { throw UniffiInternalError.panicked("UniFFI API checksum mismatch"); @@ -14501,6 +18093,16 @@ void _checkApiChecksums() { if (uniffi_moq_ffi_checksum_constructor_moqclient_new() != 48355) { throw UniffiInternalError.panicked("UniFFI API checksum mismatch"); } + if (uniffi_moq_ffi_checksum_constructor_moqvideoconsumer_subscribe() != + 44639) { + throw UniffiInternalError.panicked("UniFFI API checksum mismatch"); + } + if (uniffi_moq_ffi_checksum_constructor_moqvideoencoder_new() != 22531) { + throw UniffiInternalError.panicked("UniFFI API checksum mismatch"); + } + if (uniffi_moq_ffi_checksum_constructor_moqvideoproducer_new() != 7631) { + throw UniffiInternalError.panicked("UniFFI API checksum mismatch"); + } } void ensureInitialized() { diff --git a/doc/lib/dart/index.md b/doc/lib/dart/index.md index ac462c9d470..43616ceb97b 100644 --- a/doc/lib/dart/index.md +++ b/doc/lib/dart/index.md @@ -99,7 +99,7 @@ final remote = await moq.requestBroadcast('live/camera'); final renditions = await media.CatalogConsumer.subscribe(broadcast: remote); final decoder = await video.Consumer.subscribe( broadcast: remote, - name: 'camera', + id: 'camera', catalogVideo: (await renditions.next())!.video['camera']!, output: video.DecoderOutput(), ); From 332cad7a64359a177b22fe2368551d2035df58f1 Mon Sep 17 00:00:00 2001 From: Luke Curley <432854+kixelated@users.noreply.github.com> Date: Sat, 17 Oct 2026 03:56:38 -0700 Subject: [PATCH 7/8] feat(dart): expose the audio playout delay Rebased onto #5844, which added the audio consumer's playout delay and assigned its Dart exposure to this quest. Co-Authored-By: Claude Opus 5.5 --- dart/moq/lib/audio.dart | 12 ++++++- dart/moq/test/moq_test.dart | 64 +++++++++++++++++++++++++++++++++++ dart/moq_ffi/lib/src/moq.dart | 40 ++++++++++++++++++++++ 3 files changed, 115 insertions(+), 1 deletion(-) diff --git a/dart/moq/lib/audio.dart b/dart/moq/lib/audio.dart index 90af54ecc34..6eace5e0c6a 100644 --- a/dart/moq/lib/audio.dart +++ b/dart/moq/lib/audio.dart @@ -25,7 +25,7 @@ typedef EncoderInput = MoqAudioEncoderInput; /// The codec side: codec, track name, rate, channels, bitrate, preset, and frame duration (0 takes the codec's own frame). typedef EncoderOutput = MoqAudioEncoderOutput; -/// The PCM layout a [Consumer] delivers and how stale a group may get. +/// The PCM layout a [Consumer] delivers, how stale a group may get, and its playout delay. typedef DecoderOutput = MoqAudioDecoderOutput; /// PCM in the configured [SampleFormat], planar or interleaved, with its presentation timestamp. @@ -63,4 +63,14 @@ extension AudioDecoderOutputDuration on MoqAudioDecoderOutput { /// Upper bound on buffering before a stalled group is skipped, or null for the default. Duration? get maxDelay => maxDelayUs == null ? null : Duration(microseconds: maxDelayUs!); + + /// Fixed playout delay to hold ahead of the playhead, or null to estimate it from arrival timing. + Duration? get delay => + delayUs == null ? null : Duration(microseconds: delayUs!); +} + +/// Duration view over a consumer's playout delay. +extension AudioConsumerDuration on MoqAudioConsumer { + /// Playout delay to hold ahead of the playhead: the fixed one, or the estimate from every frame read so far. + Duration get delay => Duration(microseconds: delayUs()); } diff --git a/dart/moq/test/moq_test.dart b/dart/moq/test/moq_test.dart index 7c05d57dec5..30f126cd74e 100644 --- a/dart/moq/test/moq_test.dart +++ b/dart/moq/test/moq_test.dart @@ -476,6 +476,70 @@ void main() { broadcast.close(); }); + // A fixed playout delay is reported back as is, and an estimated one moves as frames are read. + test('audio consumer reports its playout delay', () async { + final broadcast = BroadcastProducer(); + final audio = moq_audio.Producer( + catalog: moq_media.CatalogProducer(broadcast: broadcast), + input: moq_audio.EncoderInput( + format: moq_audio.SampleFormat.f32, + sampleRate: 48000, + channels: 1, + ), + output: moq_audio.EncoderOutput( + codec: moq_audio.Codec.opus(), + track: 'mic', + ), + ); + + final consumer = broadcast.consume(); + final catalogs = await moq_media.CatalogConsumer.subscribe( + broadcast: consumer, + ).timeout(timeout); + final rendition = (await catalogs.next().timeout(timeout))!.audio['mic']!; + + final fixedOutput = moq_audio.DecoderOutput( + format: moq_audio.SampleFormat.f32, + delayUs: 80000, + ); + expect(fixedOutput.delay, const Duration(milliseconds: 80)); + final fixed = await moq_audio.Consumer.subscribe( + broadcast: consumer, + id: 'mic', + catalogAudio: rendition, + output: fixedOutput, + ).timeout(timeout); + final estimated = await moq_audio.Consumer.subscribe( + broadcast: consumer, + id: 'mic', + catalogAudio: rendition, + output: moq_audio.DecoderOutput(format: moq_audio.SampleFormat.f32), + ).timeout(timeout); + expect(fixed.delay, const Duration(milliseconds: 80)); + final initial = estimated.delay; + + // Two 20 ms Opus frames of silence at 48 kHz mono. + for (var i = 0; i < 2; i++) { + audio.write( + frame: moq_audio.Frame( + timestampUs: i * 20000, + data: Uint8List(960 * 4), + ), + ); + } + expect(await fixed.next().timeout(timeout), isNotNull); + expect(await estimated.next().timeout(timeout), isNotNull); + + expect(fixed.delay, const Duration(milliseconds: 80)); + expect(estimated.delay, isNot(initial)); + + fixed.cancel(); + estimated.cancel(); + audio.finish(); + catalogs.cancel(); + broadcast.close(); + }); + test('audio producer encodes opus', () { final broadcast = BroadcastProducer(); final producer = moq_audio.Producer( diff --git a/dart/moq_ffi/lib/src/moq.dart b/dart/moq_ffi/lib/src/moq.dart index a1cecf3d669..7c7a4f3cfd8 100644 --- a/dart/moq_ffi/lib/src/moq.dart +++ b/dart/moq_ffi/lib/src/moq.dart @@ -17,11 +17,13 @@ class MoqAudioDecoderOutput { final int? sampleRate; final int? channels; final int? maxDelayUs; + final int? delayUs; MoqAudioDecoderOutput({ required this.format, this.sampleRate = null, this.channels = null, this.maxDelayUs = null, + this.delayUs = null, }); } @@ -52,12 +54,18 @@ class FfiConverterMoqAudioDecoderOutput { ); final maxDelayUs = maxDelayUs_lifted.value; new_offset += maxDelayUs_lifted.bytesRead; + final delayUs_lifted = FfiConverterOptionalUInt64.read( + Uint8List.view(buf.buffer, new_offset), + ); + final delayUs = delayUs_lifted.value; + new_offset += delayUs_lifted.bytesRead; return LiftRetVal( MoqAudioDecoderOutput( format: format, sampleRate: sampleRate, channels: channels, maxDelayUs: maxDelayUs, + delayUs: delayUs, ), new_offset - buf.offsetInBytes, ); @@ -69,6 +77,7 @@ class FfiConverterMoqAudioDecoderOutput { FfiConverterOptionalUInt32.allocationSize(value.sampleRate) + FfiConverterOptionalUInt32.allocationSize(value.channels) + FfiConverterOptionalUInt64.allocationSize(value.maxDelayUs) + + FfiConverterOptionalUInt64.allocationSize(value.delayUs) + 0; final buf = Uint8List(total_length); write(value, buf); @@ -93,6 +102,10 @@ class FfiConverterMoqAudioDecoderOutput { value.maxDelayUs, Uint8List.view(buf.buffer, new_offset), ); + new_offset += FfiConverterOptionalUInt64.write( + value.delayUs, + Uint8List.view(buf.buffer, new_offset), + ); return new_offset - buf.offsetInBytes; } @@ -101,6 +114,7 @@ class FfiConverterMoqAudioDecoderOutput { FfiConverterOptionalUInt32.allocationSize(value.sampleRate) + FfiConverterOptionalUInt32.allocationSize(value.channels) + FfiConverterOptionalUInt64.allocationSize(value.maxDelayUs) + + FfiConverterOptionalUInt64.allocationSize(value.delayUs) + 0; } } @@ -6856,6 +6870,7 @@ class FfiConverterMoqAudioCodec { abstract class MoqAudioConsumerInterface { void cancel(); + int delayUs(); Future next(); } @@ -6920,6 +6935,17 @@ class MoqAudioConsumer implements MoqAudioConsumerInterface { }, null); } + int delayUs() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqaudioconsumer_delay_us( + uniffiClonePointer(), + status, + ), + FfiConverterUInt64.lift, + null, + ); + } + Future next() { return uniffiRustCallAsync( () => @@ -14116,6 +14142,14 @@ external void uniffi_moq_ffi_fn_method_moqaudioconsumer_cancel( Pointer uniffiStatus, ); +@Native, Pointer)>( + assetId: _uniffiAssetId, +) +external int uniffi_moq_ffi_fn_method_moqaudioconsumer_delay_us( + Pointer ptr, + Pointer uniffiStatus, +); + @Native Function(Pointer)>(assetId: _uniffiAssetId) external Pointer uniffi_moq_ffi_fn_method_moqaudioconsumer_next( Pointer ptr, @@ -16830,6 +16864,9 @@ external int uniffi_moq_ffi_checksum_func_moq_mint_epoch(); @Native(assetId: _uniffiAssetId) external int uniffi_moq_ffi_checksum_method_moqaudioconsumer_cancel(); +@Native(assetId: _uniffiAssetId) +external int uniffi_moq_ffi_checksum_method_moqaudioconsumer_delay_us(); + @Native(assetId: _uniffiAssetId) external int uniffi_moq_ffi_checksum_method_moqaudioconsumer_next(); @@ -17464,6 +17501,9 @@ void _checkApiChecksums() { if (uniffi_moq_ffi_checksum_method_moqaudioconsumer_cancel() != 62285) { throw UniffiInternalError.panicked("UniFFI API checksum mismatch"); } + if (uniffi_moq_ffi_checksum_method_moqaudioconsumer_delay_us() != 43882) { + throw UniffiInternalError.panicked("UniFFI API checksum mismatch"); + } if (uniffi_moq_ffi_checksum_method_moqaudioconsumer_next() != 5941) { throw UniffiInternalError.panicked("UniFFI API checksum mismatch"); } From 6091baf9fe073bcf98b7efc6cb17bfb535f86d1d Mon Sep 17 00:00:00 2001 From: Luke Curley <432854+kixelated@users.noreply.github.com> Date: Sat, 17 Oct 2026 04:21:31 -0700 Subject: [PATCH 8/8] fix(dart): build iOS from source at the release deployment target Co-Authored-By: Claude Opus 5.5 --- dart/moq_ffi/hook/build.dart | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/dart/moq_ffi/hook/build.dart b/dart/moq_ffi/hook/build.dart index 9f50115518d..cb1501c2125 100644 --- a/dart/moq_ffi/hook/build.dart +++ b/dart/moq_ffi/hook/build.dart @@ -104,7 +104,15 @@ Future<_Resolved> _build(Uri workspace, String target, String library) async { ? ['ndk', '--target', target, '--platform', '24', '--', ...cargoArgs] : [...cargoArgs, '--target', target]; - final result = await Process.run('cargo', args); + // The iOS floor release-ffi.yml builds with, which also avoids its + // ___chkstk_darwin linker errors. The hook's filtered environment drops it. + final result = await Process.run( + 'cargo', + args, + environment: target.contains('-apple-ios') + ? const {'IPHONEOS_DEPLOYMENT_TARGET': '16.0'} + : null, + ); if (result.exitCode != 0) { throw StateError( 'cargo ${args.join(' ')} failed:\n${result.stdout}\n${result.stderr}',