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..6eace5e0c6a --- /dev/null +++ b/dart/moq/lib/audio.dart @@ -0,0 +1,76 @@ +/// 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, preset, and frame duration (0 takes the codec's own frame). +typedef EncoderOutput = MoqAudioEncoderOutput; + +/// 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. +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; + +/// 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. + 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!); + + /// 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/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..30f126cd74e 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,158 @@ 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, + id: '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(); + }); + + // 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( + 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', + preset: moq_audio.Preset.lowLatency, + ), + ); + 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..cb1501c2125 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(), ]; @@ -105,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}', diff --git a/dart/moq_ffi/lib/src/moq.dart b/dart/moq_ffi/lib/src/moq.dart index 671fdfcbd49..7c7a4f3cfd8 100644 --- a/dart/moq_ffi/lib/src/moq.dart +++ b/dart/moq_ffi/lib/src/moq.dart @@ -8,3038 +8,4027 @@ 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}); + final int? delayUs; + MoqAudioDecoderOutput({ + required this.format, + this.sampleRate = null, + this.channels = null, + this.maxDelayUs = null, + this.delayUs = 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; + final delayUs_lifted = FfiConverterOptionalUInt64.read( + Uint8List.view(buf.buffer, new_offset), + ); + final delayUs = delayUs_lifted.value; + new_offset += delayUs_lifted.bytesRead; return LiftRetVal( - MoqFetchGroupOptions(priority: priority, maxDelayUs: maxDelayUs), + MoqAudioDecoderOutput( + format: format, + sampleRate: sampleRate, + channels: channels, + maxDelayUs: maxDelayUs, + delayUs: delayUs, + ), 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) + + FfiConverterOptionalUInt64.allocationSize(value.delayUs) + 0; final buf = Uint8List(total_length); write(value, buf); 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( 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; } - 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) + + FfiConverterOptionalUInt64.allocationSize(value.delayUs) + 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, + new_offset += FfiConverterUInt8.write( + value.priority, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterOptionalString.write( - value.broadcast, + new_offset += FfiConverterUInt64.write( + value.maxDelayUs, 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 += 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, + new_offset += FfiConverterOptionalUInt64.write( + value.groupStart, Uint8List.view(buf.buffer, new_offset), ); new_offset += FfiConverterOptionalUInt64.write( - value.jitterUs, + 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, - 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 += FfiConverterOptionalString.write( + value.track, Uint8List.view(buf.buffer, new_offset), ); - final width = width_lifted.value; - new_offset += width_lifted.bytesRead; - final height_lifted = FfiConverterUInt32.read( + new_offset += FfiConverterString.write( + value.codec, 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, + new_offset += FfiConverterOptionalUint8List.write( + value.description, + Uint8List.view(buf.buffer, new_offset), ); - } - - 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), ); - return new_offset - buf.offsetInBytes; - } - - static int allocationSize(MoqMediaFrame value) { - return FfiConverterUint8List.allocationSize(value.payload) + - FfiConverterUInt64.allocationSize(value.timestampUs) + - FfiConverterBool.allocationSize(value.keyframe) + + 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(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( + final sequence_lifted = FfiConverterUInt64.read( Uint8List.view(buf.buffer, new_offset), ); - final broadcast = broadcast_lifted.value; - new_offset += broadcast_lifted.bytesRead; - final track_lifted = FfiConverterOptionalString.read( + final sequence = sequence_lifted.value; + new_offset += sequence_lifted.bytesRead; + final timestampUs_lifted = FfiConverterOptionalUInt64.read( Uint8List.view(buf.buffer, new_offset), ); - final track = track_lifted.value; - new_offset += track_lifted.bytesRead; - final codec_lifted = FfiConverterString.read( + final timestampUs = timestampUs_lifted.value; + new_offset += timestampUs_lifted.bytesRead; + final payload_lifted = FfiConverterUint8List.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 payload = payload_lifted.value; + new_offset += payload_lifted.bytesRead; + return LiftRetVal( + MoqDatagram( + sequence: sequence, + timestampUs: timestampUs, + payload: payload, + ), + new_offset - buf.offsetInBytes, ); - final description = description_lifted.value; - new_offset += description_lifted.bytesRead; - final coded_lifted = FfiConverterOptionalMoqDimensions.read( + } + + static RustBuffer lower(MoqDatagram value) { + final total_length = + 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(MoqDatagram value, Uint8List buf) { + int new_offset = buf.offsetInBytes; + new_offset += FfiConverterUInt64.write( + value.sequence, Uint8List.view(buf.buffer, new_offset), ); - final coded = coded_lifted.value; - new_offset += coded_lifted.bytesRead; - final displayAspect_lifted = FfiConverterOptionalMoqDimensions.read( + new_offset += FfiConverterOptionalUInt64.write( + value.timestampUs, Uint8List.view(buf.buffer, new_offset), ); - final displayAspect = displayAspect_lifted.value; - new_offset += displayAspect_lifted.bytesRead; - final bitrate_lifted = FfiConverterOptionalUInt64.read( + new_offset += FfiConverterUint8List.write( + value.payload, 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( + 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( Uint8List.view(buf.buffer, new_offset), ); - final framerate = framerate_lifted.value; - new_offset += framerate_lifted.bytesRead; - final container_lifted = FfiConverterMoqContainer.read( + final width = width_lifted.value; + new_offset += width_lifted.bytesRead; + final height_lifted = FfiConverterUInt32.read( Uint8List.view(buf.buffer, new_offset), ); - final container = container_lifted.value; - new_offset += container_lifted.bytesRead; + final height = height_lifted.value; + new_offset += height_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, - ), + MoqDimensions(width: width, height: height), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(MoqVideo value) { + static RustBuffer lower(MoqDimensions 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) + + FfiConverterUInt32.allocationSize(value.width) + + FfiConverterUInt32.allocationSize(value.height) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(MoqVideo value, Uint8List buf) { + static int write(MoqDimensions 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.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, + new_offset += FfiConverterUInt32.write( + value.width, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterMoqContainer.write( - value.container, + new_offset += FfiConverterUInt32.write( + value.height, 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(MoqDimensions value) { + return FfiConverterUInt32.allocationSize(value.width) + + FfiConverterUInt32.allocationSize(value.height) + 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 MoqFrame { + final Uint8List payload; + final int? timestampUs; + MoqFrame({required this.payload, this.timestampUs = null}); } -class FfiConverterMoqVideoHint { - static MoqVideoHint lift(RustBuffer buf) { - return FfiConverterMoqVideoHint.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 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 payload_lifted = FfiConverterUint8List.read( Uint8List.view(buf.buffer, new_offset), ); - final framerate = framerate_lifted.value; - new_offset += framerate_lifted.bytesRead; - final optimizeForLatency_lifted = FfiConverterOptionalBool.read( + final payload = payload_lifted.value; + new_offset += payload_lifted.bytesRead; + final timestampUs_lifted = FfiConverterOptionalUInt64.read( Uint8List.view(buf.buffer, new_offset), ); - final optimizeForLatency = optimizeForLatency_lifted.value; - new_offset += optimizeForLatency_lifted.bytesRead; + final timestampUs = timestampUs_lifted.value; + new_offset += timestampUs_lifted.bytesRead; return LiftRetVal( - MoqVideoHint( - coded: coded, - displayAspect: displayAspect, - bitrate: bitrate, - framerate: framerate, - optimizeForLatency: optimizeForLatency, - ), + MoqFrame(payload: payload, timestampUs: timestampUs), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(MoqVideoHint value) { + static RustBuffer lower(MoqFrame value) { final total_length = - FfiConverterOptionalMoqDimensions.allocationSize(value.coded) + - FfiConverterOptionalMoqDimensions.allocationSize(value.displayAspect) + - FfiConverterOptionalUInt64.allocationSize(value.bitrate) + - FfiConverterOptionalDouble64.allocationSize(value.framerate) + - FfiConverterOptionalBool.allocationSize(value.optimizeForLatency) + + FfiConverterUint8List.allocationSize(value.payload) + + FfiConverterOptionalUInt64.allocationSize(value.timestampUs) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(MoqVideoHint value, Uint8List buf) { + static int write(MoqFrame 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, + new_offset += FfiConverterUint8List.write( + value.payload, Uint8List.view(buf.buffer, new_offset), ); new_offset += FfiConverterOptionalUInt64.write( - value.bitrate, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalDouble64.write( - value.framerate, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalBool.write( - value.optimizeForLatency, + value.timestampUs, 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(MoqFrame value) { + return FfiConverterUint8List.allocationSize(value.payload) + + FfiConverterOptionalUInt64.allocationSize(value.timestampUs) + 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 MoqMediaFrame { + final Uint8List payload; + final int timestampUs; + final bool keyframe; + MoqMediaFrame({ + required this.payload, + required this.timestampUs, + required this.keyframe, }); } -class FfiConverterMoqVideoInit { - static MoqVideoInit lift(RustBuffer buf) { - return FfiConverterMoqVideoInit.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 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( + final payload_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 = payload_lifted.value; + new_offset += payload_lifted.bytesRead; + final timestampUs_lifted = FfiConverterUInt64.read( Uint8List.view(buf.buffer, new_offset), ); - final label = label_lifted.value; - new_offset += label_lifted.bytesRead; - final hint_lifted = FfiConverterOptionalMoqVideoHint.read( + final timestampUs = timestampUs_lifted.value; + new_offset += timestampUs_lifted.bytesRead; + final keyframe_lifted = FfiConverterBool.read( Uint8List.view(buf.buffer, new_offset), ); - final hint = hint_lifted.value; - new_offset += hint_lifted.bytesRead; + final keyframe = keyframe_lifted.value; + new_offset += keyframe_lifted.bytesRead; return LiftRetVal( - MoqVideoInit(format: format, data: data, label: label, hint: hint), + MoqMediaFrame( + payload: payload, + timestampUs: timestampUs, + keyframe: keyframe, + ), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(MoqVideoInit value) { + static RustBuffer lower(MoqMediaFrame value) { final total_length = - FfiConverterMoqVideoFormat.allocationSize(value.format) + - FfiConverterUint8List.allocationSize(value.data) + - FfiConverterOptionalString.allocationSize(value.label) + - FfiConverterOptionalMoqVideoHint.allocationSize(value.hint) + + 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(MoqVideoInit value, Uint8List buf) { + static int write(MoqMediaFrame 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, + value.payload, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterOptionalString.write( - value.label, + new_offset += FfiConverterUInt64.write( + value.timestampUs, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterOptionalMoqVideoHint.write( - value.hint, + new_offset += FfiConverterBool.write( + value.keyframe, 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(MoqMediaFrame value) { + return FfiConverterUint8List.allocationSize(value.payload) + + FfiConverterUInt64.allocationSize(value.timestampUs) + + FfiConverterBool.allocationSize(value.keyframe) + 0; } } -class MoqVideoProperties { - final MoqDimensions? display; - final double? rotation; - final bool? flip; - MoqVideoProperties({ - this.display = null, - this.rotation = null, - this.flip = null, +class MoqMediaGroupConfig { + final MoqRendition rendition; + final int sequence; + final MoqFetchGroupOptions? options; + MoqMediaGroupConfig({ + required this.rendition, + required this.sequence, + this.options = null, }); } -class FfiConverterMoqVideoProperties { - static MoqVideoProperties lift(RustBuffer buf) { - return FfiConverterMoqVideoProperties.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 display_lifted = FfiConverterOptionalMoqDimensions.read( + final rendition_lifted = FfiConverterMoqRendition.read( Uint8List.view(buf.buffer, new_offset), ); - final display = display_lifted.value; - new_offset += display_lifted.bytesRead; - final rotation_lifted = FfiConverterOptionalDouble64.read( + final rendition = rendition_lifted.value; + new_offset += rendition_lifted.bytesRead; + final sequence_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 sequence = sequence_lifted.value; + new_offset += sequence_lifted.bytesRead; + final options_lifted = FfiConverterOptionalMoqFetchGroupOptions.read( Uint8List.view(buf.buffer, new_offset), ); - final flip = flip_lifted.value; - new_offset += flip_lifted.bytesRead; + final options = options_lifted.value; + new_offset += options_lifted.bytesRead; return LiftRetVal( - MoqVideoProperties(display: display, rotation: rotation, flip: flip), + MoqMediaGroupConfig( + rendition: rendition, + sequence: sequence, + options: options, + ), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(MoqVideoProperties value) { + static RustBuffer lower(MoqMediaGroupConfig value) { final total_length = - FfiConverterOptionalMoqDimensions.allocationSize(value.display) + - FfiConverterOptionalDouble64.allocationSize(value.rotation) + - FfiConverterOptionalBool.allocationSize(value.flip) + + 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(MoqVideoProperties value, Uint8List buf) { + static int write(MoqMediaGroupConfig value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += FfiConverterOptionalMoqDimensions.write( - value.display, + new_offset += FfiConverterMoqRendition.write( + value.rendition, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterOptionalDouble64.write( - value.rotation, + new_offset += FfiConverterUInt64.write( + value.sequence, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterOptionalBool.write( - value.flip, + new_offset += FfiConverterOptionalMoqFetchGroupOptions.write( + value.options, 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(MoqMediaGroupConfig value) { + return FfiConverterMoqRendition.allocationSize(value.rendition) + + FfiConverterUInt64.allocationSize(value.sequence) + + FfiConverterOptionalMoqFetchGroupOptions.allocationSize(value.options) + 0; } } -class MoqAnnounce { - final String prefix; - final List? captures; - final MoqRoute route; - MoqAnnounce({required this.prefix, this.captures, required this.route}); +class MoqMediaTrackConfig { + final MoqRendition rendition; + final MoqSubscription? subscription; + MoqMediaTrackConfig({required this.rendition, this.subscription = null}); } -class FfiConverterMoqAnnounce { - static MoqAnnounce lift(RustBuffer buf) { - return FfiConverterMoqAnnounce.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 captures_lifted = FfiConverterOptionalSequenceString.read( + final rendition_lifted = FfiConverterMoqRendition.read( Uint8List.view(buf.buffer, new_offset), ); - final captures = captures_lifted.value; - new_offset += captures_lifted.bytesRead; - final route_lifted = FfiConverterMoqRoute.read( + final rendition = rendition_lifted.value; + new_offset += rendition_lifted.bytesRead; + final subscription_lifted = FfiConverterOptionalMoqSubscription.read( Uint8List.view(buf.buffer, new_offset), ); - final route = route_lifted.value; - new_offset += route_lifted.bytesRead; + final subscription = subscription_lifted.value; + new_offset += subscription_lifted.bytesRead; return LiftRetVal( - MoqAnnounce(prefix: prefix, captures: captures, route: route), + MoqMediaTrackConfig(rendition: rendition, subscription: subscription), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(MoqAnnounce value) { + static RustBuffer lower(MoqMediaTrackConfig value) { final total_length = - FfiConverterString.allocationSize(value.prefix) + - FfiConverterOptionalSequenceString.allocationSize(value.captures) + - FfiConverterMoqRoute.allocationSize(value.route) + + FfiConverterMoqRendition.allocationSize(value.rendition) + + FfiConverterOptionalMoqSubscription.allocationSize(value.subscription) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(MoqAnnounce 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 += FfiConverterOptionalSequenceString.write( - value.captures, + new_offset += FfiConverterMoqRendition.write( + value.rendition, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterMoqRoute.write( - value.route, + new_offset += FfiConverterOptionalMoqSubscription.write( + value.subscription, 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(MoqMediaTrackConfig value) { + return FfiConverterMoqRendition.allocationSize(value.rendition) + + FfiConverterOptionalMoqSubscription.allocationSize(value.subscription) + 0; } } -class MoqAnnounceConfig { - final String prefix; - final String? filter; - final bool hidden; - MoqAnnounceConfig({ - this.prefix = '', - this.filter = null, - this.hidden = false, +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 FfiConverterMoqAnnounceConfig { - static MoqAnnounceConfig lift(RustBuffer buf) { - return FfiConverterMoqAnnounceConfig.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 prefix_lifted = FfiConverterString.read( + final label_lifted = FfiConverterOptionalString.read( Uint8List.view(buf.buffer, new_offset), ); - final prefix = prefix_lifted.value; - new_offset += prefix_lifted.bytesRead; - final filter_lifted = FfiConverterOptionalString.read( + final label = label_lifted.value; + new_offset += label_lifted.bytesRead; + final broadcast_lifted = FfiConverterOptionalString.read( Uint8List.view(buf.buffer, new_offset), ); - final filter = filter_lifted.value; - new_offset += filter_lifted.bytesRead; - final hidden_lifted = FfiConverterBool.read( + final broadcast = broadcast_lifted.value; + new_offset += broadcast_lifted.bytesRead; + final track_lifted = FfiConverterOptionalString.read( Uint8List.view(buf.buffer, new_offset), ); - final hidden = hidden_lifted.value; - new_offset += hidden_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 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( - MoqAnnounceConfig(prefix: prefix, filter: filter, hidden: hidden), + 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(MoqAnnounceConfig value) { + static RustBuffer lower(MoqVideo value) { final total_length = - FfiConverterString.allocationSize(value.prefix) + - FfiConverterOptionalString.allocationSize(value.filter) + - FfiConverterBool.allocationSize(value.hidden) + + 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(MoqAnnounceConfig value, Uint8List buf) { + static int write(MoqVideo value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += FfiConverterString.write( - value.prefix, + new_offset += FfiConverterOptionalString.write( + value.label, Uint8List.view(buf.buffer, new_offset), ); new_offset += FfiConverterOptionalString.write( - value.filter, + value.broadcast, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterBool.write( - value.hidden, + new_offset += FfiConverterOptionalString.write( + value.track, 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( + new_offset += FfiConverterString.write( + value.codec, 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, + 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), ); - } - - 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.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, - Uint8List.view(buf.buffer, new_offset), - ); - new_offset += FfiConverterOptionalUInt32.write( - value.multiplier, + new_offset += FfiConverterString.write( + value.prefix, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterOptionalUInt64.write( - value.maxUs, + new_offset += FfiConverterOptionalString.write( + value.filter, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterOptionalUInt64.write( - value.timeoutUs, + new_offset += FfiConverterBool.write( + value.hidden, 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(MoqAnnounceConfig value) { + return FfiConverterString.allocationSize(value.prefix) + + FfiConverterOptionalString.allocationSize(value.filter) + + FfiConverterBool.allocationSize(value.hidden) + 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 MoqOriginConfig { + final int? cacheCapacityBytes; + MoqOriginConfig({this.cacheCapacityBytes = null}); } -class FfiConverterMoqClientConfig { - static MoqClientConfig lift(RustBuffer buf) { - return FfiConverterMoqClientConfig.read(buf.asUint8List()).value; +class FfiConverterMoqOriginConfig { + static MoqOriginConfig lift(RustBuffer buf) { + return FfiConverterMoqOriginConfig.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 = FfiConverterMoqClientTls.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 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( + final cacheCapacityBytes_lifted = FfiConverterOptionalUInt64.read( Uint8List.view(buf.buffer, new_offset), ); - final consume = consume_lifted.value; - new_offset += consume_lifted.bytesRead; + final cacheCapacityBytes = cacheCapacityBytes_lifted.value; + new_offset += cacheCapacityBytes_lifted.bytesRead; return LiftRetVal( - MoqClientConfig( - bind: bind, - versions: versions, - tls: tls, - quic: quic, - websocket: websocket, - once: once, - backoff: backoff, - publish: publish, - consume: consume, - ), + MoqOriginConfig(cacheCapacityBytes: cacheCapacityBytes), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(MoqClientConfig value) { + static RustBuffer lower(MoqOriginConfig 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; + FfiConverterOptionalUInt64.allocationSize(value.cacheCapacityBytes) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(MoqClientConfig value, Uint8List buf) { + static int write(MoqOriginConfig 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, + new_offset += FfiConverterOptionalUInt64.write( + value.cacheCapacityBytes, 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) + + static int allocationSize(MoqOriginConfig value) { + return FfiConverterOptionalUInt64.allocationSize(value.cacheCapacityBytes) + 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 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 FfiConverterMoqClientTls { - static MoqClientTls lift(RustBuffer buf) { - return FfiConverterMoqClientTls.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 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( + final hops_lifted = FfiConverterSequenceUInt64.read( Uint8List.view(buf.buffer, new_offset), ); - final systemRoots = systemRoots_lifted.value; - new_offset += systemRoots_lifted.bytesRead; - final fingerprints_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 fingerprints = fingerprints_lifted.value; - new_offset += fingerprints_lifted.bytesRead; - final cert_lifted = FfiConverterOptionalString.read( + final cost = cost_lifted.value; + new_offset += cost_lifted.bytesRead; + final anonymous_lifted = FfiConverterBool.read( Uint8List.view(buf.buffer, new_offset), ); - final cert = cert_lifted.value; - new_offset += cert_lifted.bytesRead; - final key_lifted = FfiConverterOptionalString.read( + final anonymous = anonymous_lifted.value; + new_offset += anonymous_lifted.bytesRead; + final epoch_lifted = FfiConverterOptionalString.read( Uint8List.view(buf.buffer, new_offset), ); - final key = key_lifted.value; - new_offset += key_lifted.bytesRead; + final epoch = epoch_lifted.value; + new_offset += epoch_lifted.bytesRead; return LiftRetVal( - MoqClientTls( - insecure: insecure, - roots: roots, - systemRoots: systemRoots, - fingerprints: fingerprints, - cert: cert, - key: key, - ), + MoqRoute(hops: hops, cost: cost, anonymous: anonymous, epoch: epoch), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(MoqClientTls value) { + static RustBuffer lower(MoqRoute 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) + + 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(MoqClientTls value, Uint8List buf) { + static int write(MoqRoute 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, + new_offset += FfiConverterSequenceUInt64.write( + value.hops, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterSequenceString.write( - value.fingerprints, + new_offset += FfiConverterUInt64.write( + value.cost, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterOptionalString.write( - value.cert, + new_offset += FfiConverterBool.write( + value.anonymous, Uint8List.view(buf.buffer, new_offset), ); new_offset += FfiConverterOptionalString.write( - value.key, + value.epoch, 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(MoqRoute value) { + return FfiConverterSequenceUInt64.allocationSize(value.hops) + + FfiConverterUInt64.allocationSize(value.cost) + + FfiConverterBool.allocationSize(value.anonymous) + + FfiConverterOptionalString.allocationSize(value.epoch) + 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 MoqTrackInfo { + final int priority; + final int? maxAgeUs; + final int? timescale; + MoqTrackInfo({ + this.priority = 127, + this.maxAgeUs = null, + this.timescale = null, }); } -class FfiConverterMoqConnectionStats { - static MoqConnectionStats lift(RustBuffer buf) { - return FfiConverterMoqConnectionStats.read(buf.asUint8List()).value; +class FfiConverterMoqTrackInfo { + static MoqTrackInfo lift(RustBuffer buf) { + return FfiConverterMoqTrackInfo.read(buf.asUint8List()).value; } - static LiftRetVal read(Uint8List buf) { + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - final rttUs_lifted = FfiConverterOptionalUInt64.read( + final priority_lifted = FfiConverterUInt8.read( Uint8List.view(buf.buffer, new_offset), ); - final rttUs = rttUs_lifted.value; - new_offset += rttUs_lifted.bytesRead; - final estimatedSendRateBps_lifted = FfiConverterOptionalUInt64.read( + final priority = priority_lifted.value; + new_offset += priority_lifted.bytesRead; + final maxAgeUs_lifted = FfiConverterOptionalUInt64.read( Uint8List.view(buf.buffer, new_offset), ); - final estimatedSendRateBps = estimatedSendRateBps_lifted.value; - new_offset += estimatedSendRateBps_lifted.bytesRead; - final estimatedRecvRateBps_lifted = FfiConverterOptionalUInt64.read( + final maxAgeUs = maxAgeUs_lifted.value; + new_offset += maxAgeUs_lifted.bytesRead; + final timescale_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 timescale = timescale_lifted.value; + new_offset += timescale_lifted.bytesRead; + return LiftRetVal( + MoqTrackInfo( + priority: priority, + maxAgeUs: maxAgeUs, + timescale: timescale, + ), + new_offset - buf.offsetInBytes, ); - final bytesSent = bytesSent_lifted.value; - new_offset += bytesSent_lifted.bytesRead; - final bytesReceived_lifted = FfiConverterOptionalUInt64.read( + } + + 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), ); - final bytesReceived = bytesReceived_lifted.value; - new_offset += bytesReceived_lifted.bytesRead; - final bytesLost_lifted = FfiConverterOptionalUInt64.read( + new_offset += FfiConverterOptionalUInt64.write( + value.maxAgeUs, Uint8List.view(buf.buffer, new_offset), ); - final bytesLost = bytesLost_lifted.value; - new_offset += bytesLost_lifted.bytesRead; - final packetsSent_lifted = FfiConverterOptionalUInt64.read( + new_offset += FfiConverterOptionalUInt64.write( + value.timescale, Uint8List.view(buf.buffer, new_offset), ); - final packetsSent = packetsSent_lifted.value; - new_offset += packetsSent_lifted.bytesRead; - final packetsReceived_lifted = FfiConverterOptionalUInt64.read( + 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 packetsReceived = packetsReceived_lifted.value; - new_offset += packetsReceived_lifted.bytesRead; - final packetsLost_lifted = FfiConverterOptionalUInt64.read( + final bind = bind_lifted.value; + new_offset += bind_lifted.bytesRead; + final versions_lifted = FfiConverterSequenceString.read( Uint8List.view(buf.buffer, new_offset), ); - final packetsLost = packetsLost_lifted.value; - new_offset += packetsLost_lifted.bytesRead; + 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( - MoqConnectionStats( - rttUs: rttUs, - estimatedSendRateBps: estimatedSendRateBps, - estimatedRecvRateBps: estimatedRecvRateBps, - bytesSent: bytesSent, - bytesReceived: bytesReceived, - bytesLost: bytesLost, - packetsSent: packetsSent, - packetsReceived: packetsReceived, - packetsLost: packetsLost, + MoqServerConfig( + bind: bind, + versions: versions, + tls: tls, + quic: quic, + publish: publish, + consume: consume, ), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(MoqConnectionStats value) { + static RustBuffer lower(MoqServerConfig 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) + + FfiConverterOptionalString.allocationSize(value.bind) + + FfiConverterSequenceString.allocationSize(value.versions) + + FfiConverterMoqServerTls.allocationSize(value.tls) + + FfiConverterMoqQuicConfig.allocationSize(value.quic) + + FfiConverterOptionalMoqOriginProducer.allocationSize(value.publish) + + FfiConverterOptionalMoqOriginProducer.allocationSize(value.consume) + 0; final buf = Uint8List(total_length); write(value, buf); return toRustBuffer(buf); } - static int write(MoqConnectionStats value, Uint8List buf) { + static int write(MoqServerConfig 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, + new_offset += FfiConverterOptionalString.write( + value.bind, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterOptionalUInt64.write( - value.bytesReceived, + new_offset += FfiConverterSequenceString.write( + value.versions, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterOptionalUInt64.write( - value.bytesLost, + new_offset += FfiConverterMoqServerTls.write( + value.tls, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterOptionalUInt64.write( - value.packetsSent, + new_offset += FfiConverterMoqQuicConfig.write( + value.quic, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterOptionalUInt64.write( - value.packetsReceived, + new_offset += FfiConverterOptionalMoqOriginProducer.write( + value.publish, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterOptionalUInt64.write( - value.packetsLost, + new_offset += FfiConverterOptionalMoqOriginProducer.write( + value.consume, 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(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) + 0; } } -class MoqQuicConfig { - final int? maxStreams; - MoqQuicConfig({this.maxStreams = null}); +class MoqServerTls { + final List cert; + final List key; + final List generate; + MoqServerTls({ + this.cert = const [], + this.key = const [], + this.generate = const [], + }); } -class FfiConverterMoqQuicConfig { - static MoqQuicConfig lift(RustBuffer buf) { - return FfiConverterMoqQuicConfig.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 maxStreams_lifted = FfiConverterOptionalUInt64.read( + final cert_lifted = FfiConverterSequenceString.read( Uint8List.view(buf.buffer, new_offset), ); - final maxStreams = maxStreams_lifted.value; - new_offset += maxStreams_lifted.bytesRead; + final cert = cert_lifted.value; + new_offset += cert_lifted.bytesRead; + 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( - MoqQuicConfig(maxStreams: maxStreams), + MoqServerTls(cert: cert, key: key, generate: generate), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(MoqQuicConfig value) { + static RustBuffer lower(MoqServerTls value) { final total_length = - FfiConverterOptionalUInt64.allocationSize(value.maxStreams) + 0; + 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(MoqQuicConfig value, Uint8List buf) { + static int write(MoqServerTls value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += FfiConverterOptionalUInt64.write( - value.maxStreams, + new_offset += FfiConverterSequenceString.write( + value.cert, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterSequenceString.write( + value.key, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterSequenceString.write( + value.generate, Uint8List.view(buf.buffer, new_offset), ); return new_offset - buf.offsetInBytes; } - static int allocationSize(MoqQuicConfig value) { - return FfiConverterOptionalUInt64.allocationSize(value.maxStreams) + 0; + static int allocationSize(MoqServerTls value) { + return FfiConverterSequenceString.allocationSize(value.cert) + + FfiConverterSequenceString.allocationSize(value.key) + + FfiConverterSequenceString.allocationSize(value.generate) + + 0; } } -class MoqWebSocketConfig { - final bool? enabled; - final int? delayUs; - MoqWebSocketConfig({this.enabled = null, this.delayUs = null}); +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 FfiConverterMoqWebSocketConfig { - static MoqWebSocketConfig lift(RustBuffer buf) { - return FfiConverterMoqWebSocketConfig.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 enabled_lifted = FfiConverterOptionalBool.read( + final initialUs_lifted = FfiConverterOptionalUInt64.read( Uint8List.view(buf.buffer, new_offset), ); - final enabled = enabled_lifted.value; - new_offset += enabled_lifted.bytesRead; - final delayUs_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 delayUs = delayUs_lifted.value; - new_offset += delayUs_lifted.bytesRead; + final multiplier = multiplier_lifted.value; + new_offset += multiplier_lifted.bytesRead; + final maxUs_lifted = FfiConverterOptionalUInt64.read( + Uint8List.view(buf.buffer, new_offset), + ); + final maxUs = maxUs_lifted.value; + new_offset += maxUs_lifted.bytesRead; + final timeoutUs_lifted = FfiConverterOptionalUInt64.read( + Uint8List.view(buf.buffer, new_offset), + ); + final timeoutUs = timeoutUs_lifted.value; + new_offset += timeoutUs_lifted.bytesRead; return LiftRetVal( - MoqWebSocketConfig(enabled: enabled, delayUs: delayUs), + MoqBackoff( + initialUs: initialUs, + multiplier: multiplier, + maxUs: maxUs, + timeoutUs: timeoutUs, + ), new_offset - buf.offsetInBytes, ); } - static RustBuffer lower(MoqWebSocketConfig value) { + static RustBuffer lower(MoqBackoff value) { final total_length = - FfiConverterOptionalBool.allocationSize(value.enabled) + - FfiConverterOptionalUInt64.allocationSize(value.delayUs) + + 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(MoqWebSocketConfig value, Uint8List buf) { + static int write(MoqBackoff value, Uint8List buf) { int new_offset = buf.offsetInBytes; - new_offset += FfiConverterOptionalBool.write( - value.enabled, + new_offset += FfiConverterOptionalUInt64.write( + value.initialUs, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalUInt32.write( + value.multiplier, Uint8List.view(buf.buffer, new_offset), ); new_offset += FfiConverterOptionalUInt64.write( - value.delayUs, + value.maxUs, + Uint8List.view(buf.buffer, new_offset), + ); + new_offset += FfiConverterOptionalUInt64.write( + value.timeoutUs, 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(MoqBackoff value) { + return FfiConverterOptionalUInt64.allocationSize(value.initialUs) + + FfiConverterOptionalUInt32.allocationSize(value.multiplier) + + FfiConverterOptionalUInt64.allocationSize(value.maxUs) + + FfiConverterOptionalUInt64.allocationSize(value.timeoutUs) + 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, +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 FfiConverterMoqClientConfig { + static MoqClientConfig lift(RustBuffer buf) { + return FfiConverterMoqClientConfig.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 = FfiConverterMoqClientTls.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 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, ), - FfiConverterString.lift, + new_offset - buf.offsetInBytes, + ); + } + + 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 FfiConverterMoqException { - static MoqException lift(RustBuffer buffer) { - return FfiConverterMoqException.read(buffer.asUint8List()).value; +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 FfiConverterMoqClientTls { + static MoqClientTls lift(RustBuffer buf) { + return FfiConverterMoqClientTls.read(buf.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( + 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( + 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( + MoqClientTls( + insecure: insecure, + roots: roots, + systemRoots: systemRoots, + fingerprints: fingerprints, + cert: cert, + key: key, + ), + new_offset - buf.offsetInBytes, + ); + } + + static RustBuffer lower(MoqClientTls 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) + + 0; + final buf = Uint8List(total_length); + write(value, buf); + return toRustBuffer(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.systemRoots, + Uint8List.view(buf.buffer, new_offset), + ); + 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(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; + } +} + +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, ); @@ -3074,150 +4063,162 @@ class FfiConverterMoqException { lifted.bytesRead - subview.offsetInBytes + 4, ); case 7: - final lifted = UrlMoqException.read(subview); + final lifted = AudioMoqException.read(subview); return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); case 8: - final lifted = TimeOverflowMoqException.read(subview); + final lifted = VideoMoqException.read(subview); return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); case 9: - final lifted = LogLevelMoqException.read(subview); + final lifted = UrlMoqException.read(subview); return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); case 10: - final lifted = TaskMoqException.read(subview); + final lifted = TimeOverflowMoqException.read(subview); return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); case 11: - final lifted = JsonMoqException.read(subview); + final lifted = LogLevelMoqException.read(subview); return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); case 12: - final lifted = CancelledMoqException.read(subview); + final lifted = TaskMoqException.read(subview); return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); case 13: - final lifted = ClosedMoqException.read(subview); + final lifted = JsonMoqException.read(subview); return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); case 14: - final lifted = BusyMoqException.read(subview); + final lifted = CancelledMoqException.read(subview); return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); case 15: - final lifted = ConnectMoqException.read(subview); + final lifted = ClosedMoqException.read(subview); return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); case 16: - final lifted = BindMoqException.read(subview); + final lifted = BusyMoqException.read(subview); return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); case 17: - final lifted = RejectMoqException.read(subview); + final lifted = ConnectMoqException.read(subview); return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); case 18: - final lifted = AlreadyRespondedMoqException.read(subview); + final lifted = BindMoqException.read(subview); return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); case 19: - final lifted = CodecMoqException.read(subview); + final lifted = RejectMoqException.read(subview); return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); case 20: - final lifted = UnauthorizedMoqException.read(subview); + final lifted = AlreadyRespondedMoqException.read(subview); return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); case 21: - final lifted = ForbiddenMoqException.read(subview); + final lifted = CodecMoqException.read(subview); return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); case 22: - final lifted = ExpiredMoqException.read(subview); + final lifted = UnauthorizedMoqException.read(subview); return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); case 23: - final lifted = NotFoundMoqException.read(subview); + final lifted = ForbiddenMoqException.read(subview); return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); case 24: - final lifted = UnsupportedMoqException.read(subview); + final lifted = ExpiredMoqException.read(subview); return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); case 25: - final lifted = AlreadyCommittedMoqException.read(subview); + final lifted = NotFoundMoqException.read(subview); return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); case 26: - final lifted = InvalidRouteMoqException.read(subview); + final lifted = UnsupportedMoqException.read(subview); return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); case 27: - final lifted = InvalidPatternMoqException.read(subview); + final lifted = AlreadyCommittedMoqException.read(subview); return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); case 28: - final lifted = InvalidEpochMoqException.read(subview); + final lifted = InvalidRouteMoqException.read(subview); return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); case 29: - final lifted = UnresolvableBroadcastMoqException.read(subview); + final lifted = InvalidPatternMoqException.read(subview); return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); case 30: - final lifted = LogMoqException.read(subview); + 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, @@ -3231,31 +4232,599 @@ class FfiConverterMoqException { } } - static RustBuffer lower(MoqException value) { - return value.lower(); + 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; } - static int allocationSize(MoqException value) { - return value.allocationSize(); + @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; } +} - static int write(MoqException value, Uint8List buf) { - return value.write(buf) - buf.offsetInBytes; +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 ProtocolMoqException extends MoqException { - final MoqProtocolException details; - ProtocolMoqException(MoqProtocolException this.details); - ProtocolMoqException._(MoqProtocolException this.details); - static LiftRetVal read(Uint8List buf) { +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 details_lifted = FfiConverterMoqProtocolError.read( + final reason_lifted = FfiConverterString.read( Uint8List.view(buf.buffer, new_offset), ); - final details = details_lifted.value; - new_offset += details_lifted.bytesRead; - return LiftRetVal(ProtocolMoqException._(details), new_offset); + final reason = reason_lifted.value; + new_offset += reason_lifted.bytesRead; + return LiftRetVal(ConnectMoqException._(reason), new_offset); } @override @@ -3267,33 +4836,33 @@ class ProtocolMoqException extends MoqException { @override int allocationSize() { - return FfiConverterMoqProtocolError.allocationSize(details) + 4; + return FfiConverterString.allocationSize(reason) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 17); int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterMoqProtocolError.write( - details, + new_offset += FfiConverterString.write( + reason, Uint8List.view(buf.buffer, new_offset), ); return new_offset; } } -class TransportMoqException extends MoqException { +class BindMoqException extends MoqException { final String reason; - TransportMoqException(String this.reason); - TransportMoqException._(String this.reason); - static LiftRetVal read(Uint8List buf) { + 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(TransportMoqException._(reason), new_offset); + return LiftRetVal(BindMoqException._(reason), new_offset); } @override @@ -3310,7 +4879,7 @@ class TransportMoqException extends MoqException { @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 2); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 18); int new_offset = buf.offsetInBytes + 4; new_offset += FfiConverterString.write( reason, @@ -3320,18 +4889,18 @@ class TransportMoqException extends MoqException { } } -class InternalMoqException extends MoqException { +class RejectMoqException extends MoqException { final String reason; - InternalMoqException(String this.reason); - InternalMoqException._(String this.reason); - static LiftRetVal read(Uint8List buf) { + 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(InternalMoqException._(reason), new_offset); + return LiftRetVal(RejectMoqException._(reason), new_offset); } @override @@ -3348,7 +4917,7 @@ class InternalMoqException extends MoqException { @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 3); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 19); int new_offset = buf.offsetInBytes + 4; new_offset += FfiConverterString.write( reason, @@ -3358,18 +4927,12 @@ class InternalMoqException extends MoqException { } } -class MediaMoqException extends MoqException { - final String reason; - MediaMoqException(String this.reason); - MediaMoqException._(String this.reason); - static LiftRetVal read(Uint8List buf) { +class AlreadyRespondedMoqException extends MoqException { + AlreadyRespondedMoqException(); + AlreadyRespondedMoqException._(); + 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); + return LiftRetVal(AlreadyRespondedMoqException._(), new_offset); } @override @@ -3381,33 +4944,29 @@ class MediaMoqException extends MoqException { @override int allocationSize() { - return FfiConverterString.allocationSize(reason) + 4; + return 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 4); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 20); int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - reason, - Uint8List.view(buf.buffer, new_offset), - ); return new_offset; } } -class MuxMoqException extends MoqException { +class CodecMoqException extends MoqException { final String reason; - MuxMoqException(String this.reason); - MuxMoqException._(String this.reason); - static LiftRetVal read(Uint8List buf) { + 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(MuxMoqException._(reason), new_offset); + return LiftRetVal(CodecMoqException._(reason), new_offset); } @override @@ -3424,7 +4983,7 @@ class MuxMoqException extends MoqException { @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 5); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 21); int new_offset = buf.offsetInBytes + 4; new_offset += FfiConverterString.write( reason, @@ -3434,18 +4993,12 @@ class MuxMoqException extends MoqException { } } -class JsonTrackMoqException extends MoqException { - final String reason; - JsonTrackMoqException(String this.reason); - JsonTrackMoqException._(String this.reason); - static LiftRetVal read(Uint8List buf) { +class UnauthorizedMoqException extends MoqException { + UnauthorizedMoqException(); + UnauthorizedMoqException._(); + 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); + return LiftRetVal(UnauthorizedMoqException._(), new_offset); } @override @@ -3457,33 +5010,23 @@ class JsonTrackMoqException extends MoqException { @override int allocationSize() { - return FfiConverterString.allocationSize(reason) + 4; + return 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 6); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 22); 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) { +class ForbiddenMoqException extends MoqException { + ForbiddenMoqException(); + ForbiddenMoqException._(); + 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); + return LiftRetVal(ForbiddenMoqException._(), new_offset); } @override @@ -3495,27 +5038,23 @@ class UrlMoqException extends MoqException { @override int allocationSize() { - return FfiConverterString.allocationSize(reason) + 4; + return 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 7); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 23); 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) { +class ExpiredMoqException extends MoqException { + ExpiredMoqException(); + ExpiredMoqException._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(TimeOverflowMoqException._(), new_offset); + return LiftRetVal(ExpiredMoqException._(), new_offset); } @override @@ -3532,24 +5071,18 @@ class TimeOverflowMoqException extends MoqException { @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 8); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 24); 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) { +class NotFoundMoqException extends MoqException { + NotFoundMoqException(); + NotFoundMoqException._(); + 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); + return LiftRetVal(NotFoundMoqException._(), new_offset); } @override @@ -3561,33 +5094,23 @@ class LogLevelMoqException extends MoqException { @override int allocationSize() { - return FfiConverterString.allocationSize(reason) + 4; + return 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 9); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 25); 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) { +class UnsupportedMoqException extends MoqException { + UnsupportedMoqException(); + UnsupportedMoqException._(); + 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); + return LiftRetVal(UnsupportedMoqException._(), new_offset); } @override @@ -3599,33 +5122,57 @@ class TaskMoqException extends MoqException { @override int allocationSize() { - return FfiConverterString.allocationSize(reason) + 4; + return 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 10); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 26); int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - reason, - Uint8List.view(buf.buffer, new_offset), - ); return new_offset; } } -class JsonMoqException extends MoqException { +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; - JsonMoqException(String this.reason); - JsonMoqException._(String this.reason); - static LiftRetVal read(Uint8List buf) { + 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(JsonMoqException._(reason), new_offset); + return LiftRetVal(InvalidRouteMoqException._(reason), new_offset); } @override @@ -3642,7 +5189,7 @@ class JsonMoqException extends MoqException { @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 11); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 28); int new_offset = buf.offsetInBytes + 4; new_offset += FfiConverterString.write( reason, @@ -3652,12 +5199,18 @@ class JsonMoqException extends MoqException { } } -class CancelledMoqException extends MoqException { - CancelledMoqException(); - CancelledMoqException._(); - static LiftRetVal read(Uint8List buf) { +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; - return LiftRetVal(CancelledMoqException._(), new_offset); + 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 @@ -3669,23 +5222,33 @@ class CancelledMoqException extends MoqException { @override int allocationSize() { - return 4; + return FfiConverterString.allocationSize(reason) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 12); + 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 ClosedMoqException extends MoqException { - ClosedMoqException(); - ClosedMoqException._(); - static LiftRetVal read(Uint8List buf) { +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; - return LiftRetVal(ClosedMoqException._(), new_offset); + 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 @@ -3697,23 +5260,33 @@ class ClosedMoqException extends MoqException { @override int allocationSize() { - return 4; + return FfiConverterString.allocationSize(reason) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 13); + 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 BusyMoqException extends MoqException { - BusyMoqException(); - BusyMoqException._(); - static LiftRetVal read(Uint8List buf) { +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; - return LiftRetVal(BusyMoqException._(), new_offset); + 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 @@ -3725,29 +5298,33 @@ class BusyMoqException extends MoqException { @override int allocationSize() { - return 4; + return FfiConverterString.allocationSize(reason) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 14); + 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 ConnectMoqException extends MoqException { +class LogMoqException extends MoqException { final String reason; - ConnectMoqException(String this.reason); - ConnectMoqException._(String this.reason); - static LiftRetVal read(Uint8List buf) { + 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(ConnectMoqException._(reason), new_offset); + return LiftRetVal(LogMoqException._(reason), new_offset); } @override @@ -3764,7 +5341,7 @@ class ConnectMoqException extends MoqException { @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 15); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 32); int new_offset = buf.offsetInBytes + 4; new_offset += FfiConverterString.write( reason, @@ -3774,18 +5351,18 @@ class ConnectMoqException extends MoqException { } } -class BindMoqException extends MoqException { +class ConfigMoqException extends MoqException { final String reason; - BindMoqException(String this.reason); - BindMoqException._(String this.reason); - static LiftRetVal read(Uint8List buf) { + 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(BindMoqException._(reason), new_offset); + return LiftRetVal(ConfigMoqException._(reason), new_offset); } @override @@ -3800,62 +5377,269 @@ class BindMoqException extends MoqException { return FfiConverterString.allocationSize(reason) + 4; } - @override - int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 16); - int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterString.write( - reason, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset; + @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: + 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: + 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", + ); + } + } + + static MoqProtocolKind lift(RustBuffer buffer) { + return FfiConverterMoqProtocolKind.read(buffer.asUint8List()).value; + } + + static RustBuffer lower(MoqProtocolKind input) { + return toRustBuffer(createUint8ListFromInt(input.index + 1)); + } + + 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; + } +} + +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", + ); + } + } + + static MoqAudioFormat lift(RustBuffer buffer) { + return FfiConverterMoqAudioFormat.read(buffer.asUint8List()).value; + } + + static RustBuffer lower(MoqAudioFormat input) { + return toRustBuffer(createUint8ListFromInt(input.index + 1)); + } + + 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 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); +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, 17); - 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 AlreadyRespondedMoqException extends MoqException { - AlreadyRespondedMoqException(); - AlreadyRespondedMoqException._(); - static LiftRetVal read(Uint8List buf) { +class LegacyMoqContainer extends MoqContainer { + LegacyMoqContainer(); + LegacyMoqContainer._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(AlreadyRespondedMoqException._(), new_offset); + return LiftRetVal(LegacyMoqContainer._(), new_offset); } @override @@ -3872,24 +5656,24 @@ class AlreadyRespondedMoqException extends MoqException { @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 18); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); 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) { +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(CodecMoqException._(reason), new_offset); + final init = init_lifted.value; + new_offset += init_lifted.bytesRead; + return LiftRetVal(CmafMoqContainer._(init), new_offset); } @override @@ -3901,27 +5685,27 @@ class CodecMoqException 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, 19); + 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 UnauthorizedMoqException extends MoqException { - UnauthorizedMoqException(); - UnauthorizedMoqException._(); - static LiftRetVal read(Uint8List buf) { +class LocMoqContainer extends MoqContainer { + LocMoqContainer(); + LocMoqContainer._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(UnauthorizedMoqException._(), new_offset); + return LiftRetVal(LocMoqContainer._(), new_offset); } @override @@ -3938,74 +5722,112 @@ class UnauthorizedMoqException extends MoqException { @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 20); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 3); 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); +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() { + static RustBuffer lower(MoqContainerFormat input) { + return toRustBuffer(createUint8ListFromInt(input.index + 1)); + } + + static int allocationSize(MoqContainerFormat _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(MoqContainerFormat 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 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 4; + static RustBuffer lower(MoqMediaTarget 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(MoqMediaTarget value) { + return value.allocationSize(); + } + + static int write(MoqMediaTarget value, Uint8List buf) { + return value.write(buf) - buf.offsetInBytes; } } -class NotFoundMoqException extends MoqException { - NotFoundMoqException(); - NotFoundMoqException._(); - 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(NotFoundMoqException._(), 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 @@ -4017,23 +5839,33 @@ class NotFoundMoqException extends MoqException { @override int allocationSize() { - return 4; + return FfiConverterOptionalString.allocationSize(name) + 4; } @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; + new_offset += FfiConverterOptionalString.write( + name, + Uint8List.view(buf.buffer, new_offset), + ); return new_offset; } } -class UnsupportedMoqException extends MoqException { - UnsupportedMoqException(); - UnsupportedMoqException._(); - static LiftRetVal read(Uint8List buf) { +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; - return LiftRetVal(UnsupportedMoqException._(), new_offset); + 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); } @override @@ -4045,23 +5877,87 @@ class UnsupportedMoqException extends MoqException { @override int allocationSize() { - return 4; + return FfiConverterMoqTrackRequest.allocationSize(request) + 4; } @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; + new_offset += FfiConverterMoqTrackRequest.write( + request, + Uint8List.view(buf.buffer, new_offset), + ); return new_offset; } } -class AlreadyCommittedMoqException extends MoqException { - AlreadyCommittedMoqException(); - AlreadyCommittedMoqException._(); - 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; - return LiftRetVal(AlreadyCommittedMoqException._(), new_offset); + 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), + ); + final config = config_lifted.value; + new_offset += config_lifted.bytesRead; + return LiftRetVal(VideoMoqRendition._(id, config), new_offset); } @override @@ -4073,29 +5969,45 @@ class AlreadyCommittedMoqException extends MoqException { @override int allocationSize() { - return 4; + return FfiConverterString.allocationSize(id) + + FfiConverterMoqVideo.allocationSize(config) + + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 25); + 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), + ); + new_offset += FfiConverterMoqVideo.write( + config, + Uint8List.view(buf.buffer, new_offset), + ); return new_offset; } } -class InvalidRouteMoqException extends MoqException { - final String reason; - InvalidRouteMoqException(String this.reason); - InvalidRouteMoqException._(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(InvalidRouteMoqException._(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 @@ -4107,71 +6019,145 @@ class InvalidRouteMoqException 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, 26); + 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 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); +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", + ); + } + } + + static MoqVideoFormat lift(RustBuffer buffer) { + return FfiConverterMoqVideoFormat.read(buffer.asUint8List()).value; + } + + static RustBuffer lower(MoqVideoFormat input) { + return toRustBuffer(createUint8ListFromInt(input.index + 1)); + } + + static int allocationSize(MoqVideoFormat _value) { + return 4; + } + + static int write(MoqVideoFormat value, Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, value.index + 1); + return 4; + } +} + +abstract class MoqAnnounceEvent { + RustBuffer lower(); + int allocationSize(); + int write(Uint8List buf); +} + +class FfiConverterMoqAnnounceEvent { + static MoqAnnounceEvent lift(RustBuffer buffer) { + return FfiConverterMoqAnnounceEvent.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 = 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", + ); + } } - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); + static RustBuffer lower(MoqAnnounceEvent value) { + return value.lower(); } - @override - int allocationSize() { - return FfiConverterString.allocationSize(reason) + 4; + static int allocationSize(MoqAnnounceEvent value) { + return value.allocationSize(); } - @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 write(MoqAnnounceEvent 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 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 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(InvalidEpochMoqException._(reason), new_offset); + final announce = announce_lifted.value; + new_offset += announce_lifted.bytesRead; + return LiftRetVal(StartMoqAnnounceEvent._(announce), new_offset); } @override @@ -4183,33 +6169,33 @@ class InvalidEpochMoqException 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, 28); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); 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 UnresolvableBroadcastMoqException extends MoqException { - final String reason; - UnresolvableBroadcastMoqException(String this.reason); - UnresolvableBroadcastMoqException._(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(UnresolvableBroadcastMoqException._(reason), new_offset); + final announce = announce_lifted.value; + new_offset += announce_lifted.bytesRead; + return LiftRetVal(UpdateMoqAnnounceEvent._(announce), new_offset); } @override @@ -4221,33 +6207,33 @@ class UnresolvableBroadcastMoqException 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, 29); + 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 LogMoqException extends MoqException { - final String reason; - LogMoqException(String this.reason); - LogMoqException._(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(LogMoqException._(reason), new_offset); + final announce = announce_lifted.value; + new_offset += announce_lifted.bytesRead; + return LiftRetVal(EndMoqAnnounceEvent._(announce), new_offset); } @override @@ -4259,33 +6245,33 @@ class LogMoqException 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, 30); + 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 ConfigMoqException extends MoqException { - final String reason; - ConfigMoqException(String this.reason); - ConfigMoqException._(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(ConfigMoqException._(reason), new_offset); + final announce = announce_lifted.value; + new_offset += announce_lifted.bytesRead; + return LiftRetVal(RestartMoqAnnounceEvent._(announce), new_offset); } @override @@ -4297,41 +6283,39 @@ class ConfigMoqException 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, 31); + 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 MoqExceptionErrorHandler extends UniffiRustCallStatusErrorHandler { - @override - Exception lift(RustBuffer errorBuf) { - return FfiConverterMoqException.lift(errorBuf); - } -} - -final MoqExceptionErrorHandler moqExceptionErrorHandler = - MoqExceptionErrorHandler(); - -enum MoqErrorScope { session, stream } +enum MoqTransport { quic, iroh, webSocket, tcp, unix, webTransport } -class FfiConverterMoqErrorScope { - static LiftRetVal read(Uint8List buf) { +class FfiConverterMoqTransport { + static LiftRetVal read(Uint8List buf) { final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); switch (index) { case 1: - return LiftRetVal(MoqErrorScope.session, 4); + return LiftRetVal(MoqTransport.quic, 4); case 2: - return LiftRetVal(MoqErrorScope.stream, 4); + 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, @@ -4340,103 +6324,36 @@ class FfiConverterMoqErrorScope { } } - static MoqErrorScope lift(RustBuffer buffer) { - return FfiConverterMoqErrorScope.read(buffer.asUint8List()).value; + static MoqTransport lift(RustBuffer buffer) { + return FfiConverterMoqTransport.read(buffer.asUint8List()).value; } - static RustBuffer lower(MoqErrorScope input) { + static RustBuffer lower(MoqTransport input) { return toRustBuffer(createUint8ListFromInt(input.index + 1)); } - static int allocationSize(MoqErrorScope _value) { + static int allocationSize(MoqTransport _value) { return 4; } - static int write(MoqErrorScope value, Uint8List buf) { + static int write(MoqTransport 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, -} +enum MoqConnectionStatus { connected, disconnected, migrating } -class FfiConverterMoqProtocolKind { - static LiftRetVal read(Uint8List buf) { +class FfiConverterMoqConnectionStatus { + static LiftRetVal read(Uint8List buf) { final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); switch (index) { case 1: - return LiftRetVal(MoqProtocolKind.cancel, 4); + return LiftRetVal(MoqConnectionStatus.connected, 4); case 2: - return LiftRetVal(MoqProtocolKind.internal, 4); + return LiftRetVal(MoqConnectionStatus.disconnected, 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); + return LiftRetVal(MoqConnectionStatus.migrating, 4); default: throw UniffiInternalError( UniffiInternalError.unexpectedEnumCase, @@ -4445,38 +6362,34 @@ class FfiConverterMoqProtocolKind { } } - static MoqProtocolKind lift(RustBuffer buffer) { - return FfiConverterMoqProtocolKind.read(buffer.asUint8List()).value; + static MoqConnectionStatus lift(RustBuffer buffer) { + return FfiConverterMoqConnectionStatus.read(buffer.asUint8List()).value; } - static RustBuffer lower(MoqProtocolKind input) { + static RustBuffer lower(MoqConnectionStatus input) { return toRustBuffer(createUint8ListFromInt(input.index + 1)); } - static int allocationSize(MoqProtocolKind _value) { + static int allocationSize(MoqConnectionStatus _value) { return 4; } - static int write(MoqProtocolKind value, Uint8List buf) { + static int write(MoqConnectionStatus value, Uint8List buf) { buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, value.index + 1); return 4; } } -enum MoqAudioFormat { aac, opus, flac, mp3 } +enum MoqVideoCodec { h264, h265 } -class FfiConverterMoqAudioFormat { - static LiftRetVal read(Uint8List buf) { +class FfiConverterMoqVideoCodec { + static LiftRetVal read(Uint8List buf) { final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); switch (index) { case 1: - return LiftRetVal(MoqAudioFormat.aac, 4); + return LiftRetVal(MoqVideoCodec.h264, 4); case 2: - return LiftRetVal(MoqAudioFormat.opus, 4); - case 3: - return LiftRetVal(MoqAudioFormat.flac, 4); - case 4: - return LiftRetVal(MoqAudioFormat.mp3, 4); + return LiftRetVal(MoqVideoCodec.h265, 4); default: throw UniffiInternalError( UniffiInternalError.unexpectedEnumCase, @@ -4485,54 +6398,60 @@ class FfiConverterMoqAudioFormat { } } - static MoqAudioFormat lift(RustBuffer buffer) { - return FfiConverterMoqAudioFormat.read(buffer.asUint8List()).value; + static MoqVideoCodec lift(RustBuffer buffer) { + return FfiConverterMoqVideoCodec.read(buffer.asUint8List()).value; } - static RustBuffer lower(MoqAudioFormat input) { + static RustBuffer lower(MoqVideoCodec input) { return toRustBuffer(createUint8ListFromInt(input.index + 1)); } - static int allocationSize(MoqAudioFormat _value) { + static int allocationSize(MoqVideoCodec _value) { return 4; } - static int write(MoqAudioFormat value, Uint8List buf) { + static int write(MoqVideoCodec value, Uint8List buf) { buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, value.index + 1); return 4; } } -abstract class MoqContainer { +abstract class MoqVideoEncoderKind { RustBuffer lower(); int allocationSize(); int write(Uint8List buf); } -class FfiConverterMoqContainer { - static MoqContainer lift(RustBuffer buffer) { - return FfiConverterMoqContainer.read(buffer.asUint8List()).value; +class FfiConverterMoqVideoEncoderKind { + static MoqVideoEncoderKind lift(RustBuffer buffer) { + return FfiConverterMoqVideoEncoderKind.read(buffer.asUint8List()).value; } - static LiftRetVal read(Uint8List 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( + final lifted = AutoMoqVideoEncoderKind.read(subview); + return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); case 2: - final lifted = CmafMoqContainer.read(subview); - return LiftRetVal( + final lifted = HardwareMoqVideoEncoderKind.read(subview); + return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); case 3: - final lifted = LocMoqContainer.read(subview); - return LiftRetVal( + 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, ); @@ -4544,25 +6463,25 @@ class FfiConverterMoqContainer { } } - static RustBuffer lower(MoqContainer value) { + static RustBuffer lower(MoqVideoEncoderKind value) { return value.lower(); } - static int allocationSize(MoqContainer value) { + static int allocationSize(MoqVideoEncoderKind value) { return value.allocationSize(); } - static int write(MoqContainer value, Uint8List buf) { + static int write(MoqVideoEncoderKind value, Uint8List buf) { return value.write(buf) - buf.offsetInBytes; } } -class LegacyMoqContainer extends MoqContainer { - LegacyMoqContainer(); - LegacyMoqContainer._(); - static LiftRetVal read(Uint8List buf) { +class AutoMoqVideoEncoderKind extends MoqVideoEncoderKind { + AutoMoqVideoEncoderKind(); + AutoMoqVideoEncoderKind._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(LegacyMoqContainer._(), new_offset); + return LiftRetVal(AutoMoqVideoEncoderKind._(), new_offset); } @override @@ -4585,18 +6504,12 @@ class LegacyMoqContainer extends MoqContainer { } } -class CmafMoqContainer extends MoqContainer { - final Uint8List init; - CmafMoqContainer(Uint8List this.init); - CmafMoqContainer._(Uint8List this.init); - static LiftRetVal read(Uint8List buf) { +class HardwareMoqVideoEncoderKind extends MoqVideoEncoderKind { + HardwareMoqVideoEncoderKind(); + HardwareMoqVideoEncoderKind._(); + 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); + return LiftRetVal(HardwareMoqVideoEncoderKind._(), new_offset); } @override @@ -4608,27 +6521,23 @@ class CmafMoqContainer extends MoqContainer { @override int allocationSize() { - return FfiConverterUint8List.allocationSize(init) + 4; + return 4; } @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; } } -class LocMoqContainer extends MoqContainer { - LocMoqContainer(); - LocMoqContainer._(); - static LiftRetVal read(Uint8List buf) { +class SoftwareMoqVideoEncoderKind extends MoqVideoEncoderKind { + SoftwareMoqVideoEncoderKind(); + SoftwareMoqVideoEncoderKind._(); + static LiftRetVal read(Uint8List buf) { int new_offset = buf.offsetInBytes; - return LiftRetVal(LocMoqContainer._(), new_offset); + return LiftRetVal(SoftwareMoqVideoEncoderKind._(), new_offset); } @override @@ -4651,106 +6560,18 @@ class LocMoqContainer extends MoqContainer { } } -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", - ); - } - } - - static MoqContainerFormat lift(RustBuffer buffer) { - return FfiConverterMoqContainerFormat.read(buffer.asUint8List()).value; - } - - static RustBuffer lower(MoqContainerFormat input) { - return toRustBuffer(createUint8ListFromInt(input.index + 1)); - } - - 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; - } -} - -abstract class MoqMediaTarget { - RustBuffer lower(); - int allocationSize(); - int write(Uint8List buf); -} - -class FfiConverterMoqMediaTarget { - static MoqMediaTarget lift(RustBuffer buffer) { - return FfiConverterMoqMediaTarget.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 = 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 RustBuffer lower(MoqMediaTarget value) { - return value.lower(); - } - - static int allocationSize(MoqMediaTarget value) { - return value.allocationSize(); - } - - static int write(MoqMediaTarget value, Uint8List buf) { - return value.write(buf) - buf.offsetInBytes; - } -} - -class NamedMoqMediaTarget extends MoqMediaTarget { - final String? name; - NamedMoqMediaTarget(String? this.name); - NamedMoqMediaTarget._(String? this.name); - 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 name_lifted = FfiConverterOptionalString.read( + final name_lifted = FfiConverterString.read( Uint8List.view(buf.buffer, new_offset), ); final name = name_lifted.value; new_offset += name_lifted.bytesRead; - return LiftRetVal(NamedMoqMediaTarget._(name), new_offset); + return LiftRetVal(NamedMoqVideoEncoderKind._(name), new_offset); } @override @@ -4762,14 +6583,14 @@ class NamedMoqMediaTarget extends MoqMediaTarget { @override int allocationSize() { - return FfiConverterOptionalString.allocationSize(name) + 4; + return FfiConverterString.allocationSize(name) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 4); int new_offset = buf.offsetInBytes + 4; - new_offset += FfiConverterOptionalString.write( + new_offset += FfiConverterString.write( name, Uint8List.view(buf.buffer, new_offset), ); @@ -4777,160 +6598,60 @@ class NamedMoqMediaTarget extends MoqMediaTarget { } } -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); - } - - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); - } - - @override - int allocationSize() { - return FfiConverterMoqTrackRequest.allocationSize(request) + 4; - } - - @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; - } -} - -abstract class MoqRendition { +abstract class MoqVideoGop { 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 FfiConverterMoqVideoGop { + static MoqVideoGop lift(RustBuffer buffer) { + return FfiConverterMoqVideoGop.read(buffer.asUint8List()).value; } -} -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), - ); - final config = config_lifted.value; - new_offset += config_lifted.bytesRead; - return LiftRetVal(VideoMoqRendition._(id, config), new_offset); + 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 - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); + static RustBuffer lower(MoqVideoGop value) { + return value.lower(); } - @override - int allocationSize() { - return FfiConverterString.allocationSize(id) + - FfiConverterMoqVideo.allocationSize(config) + - 4; + static int allocationSize(MoqVideoGop value) { + return value.allocationSize(); } - @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), - ); - new_offset += FfiConverterMoqVideo.write( - config, - Uint8List.view(buf.buffer, new_offset), - ); - return new_offset; + static int write(MoqVideoGop value, Uint8List buf) { + return value.write(buf) - buf.offsetInBytes; } } -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) { +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 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( + final interval_lifted = FfiConverterUInt32.read( Uint8List.view(buf.buffer, new_offset), ); - final config = config_lifted.value; - new_offset += config_lifted.bytesRead; - return LiftRetVal(AudioMoqRendition._(id, config), new_offset); + final interval = interval_lifted.value; + new_offset += interval_lifted.bytesRead; + return LiftRetVal(KeyframeMoqVideoGop._(interval), new_offset); } @override @@ -4942,47 +6663,31 @@ class AudioMoqRendition extends MoqRendition { @override int allocationSize() { - return FfiConverterString.allocationSize(id) + - FfiConverterMoqAudio.allocationSize(config) + - 4; + return FfiConverterUInt32.allocationSize(interval) + 4; } @override int write(Uint8List buf) { - buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 2); + 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), - ); - new_offset += FfiConverterMoqAudio.write( - config, + new_offset += FfiConverterUInt32.write( + interval, Uint8List.view(buf.buffer, new_offset), ); return new_offset; } } -enum MoqVideoFormat { avc1, avc3, hvc1, hev1, av01, vp8, vp9 } +enum MoqVideoPixelFormat { i420, rgba } -class FfiConverterMoqVideoFormat { - static LiftRetVal read(Uint8List buf) { +class FfiConverterMoqVideoPixelFormat { + static LiftRetVal read(Uint8List buf) { final index = buf.buffer.asByteData(buf.offsetInBytes).getInt32(0); switch (index) { case 1: - return LiftRetVal(MoqVideoFormat.avc1, 4); + return LiftRetVal(MoqVideoPixelFormat.i420, 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); + return LiftRetVal(MoqVideoPixelFormat.rgba, 4); default: throw UniffiInternalError( UniffiInternalError.unexpectedEnumCase, @@ -4991,60 +6696,42 @@ class FfiConverterMoqVideoFormat { } } - static MoqVideoFormat lift(RustBuffer buffer) { - return FfiConverterMoqVideoFormat.read(buffer.asUint8List()).value; + static MoqVideoPixelFormat lift(RustBuffer buffer) { + return FfiConverterMoqVideoPixelFormat.read(buffer.asUint8List()).value; } - static RustBuffer lower(MoqVideoFormat input) { + static RustBuffer lower(MoqVideoPixelFormat input) { return toRustBuffer(createUint8ListFromInt(input.index + 1)); } - static int allocationSize(MoqVideoFormat _value) { + static int allocationSize(MoqVideoPixelFormat _value) { return 4; } - static int write(MoqVideoFormat value, Uint8List buf) { + static int write(MoqVideoPixelFormat value, Uint8List buf) { buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, value.index + 1); return 4; } } -abstract class MoqAnnounceEvent { +abstract class MoqVideoSurface { RustBuffer lower(); int allocationSize(); int write(Uint8List buf); } -class FfiConverterMoqAnnounceEvent { - static MoqAnnounceEvent lift(RustBuffer buffer) { - return FfiConverterMoqAnnounceEvent.read(buffer.asUint8List()).value; +class FfiConverterMoqVideoSurface { + static MoqVideoSurface lift(RustBuffer buffer) { + return FfiConverterMoqVideoSurface.read(buffer.asUint8List()).value; } - static LiftRetVal read(Uint8List 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( + final lifted = PixelBufferMoqVideoSurface.read(subview); + return LiftRetVal( lifted.value, lifted.bytesRead - subview.offsetInBytes + 4, ); @@ -5056,250 +6743,510 @@ class FfiConverterMoqAnnounceEvent { } } - static RustBuffer lower(MoqAnnounceEvent value) { + static RustBuffer lower(MoqVideoSurface value) { return value.lower(); } - static int allocationSize(MoqAnnounceEvent value) { + static int allocationSize(MoqVideoSurface value) { return value.allocationSize(); } - static int write(MoqAnnounceEvent value, Uint8List buf) { + static int write(MoqVideoSurface value, Uint8List buf) { return value.write(buf) - buf.offsetInBytes; } } -class StartMoqAnnounceEvent extends MoqAnnounceEvent { - final MoqAnnounce announce; - StartMoqAnnounceEvent(MoqAnnounce this.announce); - StartMoqAnnounceEvent._(MoqAnnounce this.announce); - 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 announce_lifted = FfiConverterMoqAnnounce.read( + final pointer_lifted = FfiConverterUInt64.read( Uint8List.view(buf.buffer, new_offset), ); - final announce = announce_lifted.value; - new_offset += announce_lifted.bytesRead; - return LiftRetVal(StartMoqAnnounceEvent._(announce), new_offset); + final pointer = pointer_lifted.value; + new_offset += pointer_lifted.bytesRead; + return LiftRetVal(PixelBufferMoqVideoSurface._(pointer), new_offset); + } + + @override + RustBuffer lower() { + final buf = Uint8List(allocationSize()); + write(buf); + return toRustBuffer(buf); + } + + @override + int allocationSize() { + return FfiConverterUInt64.allocationSize(pointer) + 4; + } + + @override + int write(Uint8List buf) { + buf.buffer.asByteData(buf.offsetInBytes).setInt32(0, 1); + int new_offset = buf.offsetInBytes + 4; + new_offset += FfiConverterUInt64.write( + pointer, + Uint8List.view(buf.buffer, new_offset), + ); + return new_offset; + } +} + +abstract class MoqAudioCodecInterface {} + +final _MoqAudioCodecFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_moq_ffi_fn_free_moqaudiocodec(ptr, status)); +}); + +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), + ); + } + + void dispose() { + if (_isDisposed) { + return; + } + _isDisposed = true; + _MoqAudioCodecFinalizer.detach(this); + rustCall((status) => uniffi_moq_ffi_fn_free_moqaudiocodec(_ptr, status)); + } +} + +class FfiConverterMoqAudioCodec { + static MoqAudioCodec lift(Pointer ptr) { + return MoqAudioCodec.lift(ptr); + } + + static Pointer lower(MoqAudioCodec value) { + return value.uniffiClonePointer(); + } + + static int allocationSize(MoqAudioCodec value) { + return 8; + } + + 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; + } +} + +abstract class MoqAudioConsumerInterface { + void cancel(); + int delayUs(); + Future next(); +} + +final _MoqAudioConsumerFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_moq_ffi_fn_free_moqaudioconsumer(ptr, status)); +}); + +class MoqAudioConsumer implements MoqAudioConsumerInterface { + late final Pointer _ptr; + bool _isDisposed = false; + MoqAudioConsumer._(this._ptr) { + _MoqAudioConsumerFinalizer.attach(this, _ptr, detach: this); + } + 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, + ); + } + + 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), + ); + } + + void dispose() { + if (_isDisposed) { + return; + } + _isDisposed = true; + _MoqAudioConsumerFinalizer.detach(this); + rustCall((status) => uniffi_moq_ffi_fn_free_moqaudioconsumer(_ptr, status)); + } + + void cancel() { + return rustCall((status) { + uniffi_moq_ffi_fn_method_moqaudioconsumer_cancel( + uniffiClonePointer(), + status, + ); + }, null); + } + + int delayUs() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqaudioconsumer_delay_us( + uniffiClonePointer(), + status, + ), + FfiConverterUInt64.lift, + null, + ); + } + + 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, + ); } +} - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); +class FfiConverterMoqAudioConsumer { + static MoqAudioConsumer lift(Pointer ptr) { + return MoqAudioConsumer.lift(ptr); } - @override - int allocationSize() { - return FfiConverterMoqAnnounce.allocationSize(announce) + 4; + static Pointer lower(MoqAudioConsumer value) { + return value.uniffiClonePointer(); } - @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), - ); - return new_offset; + static int allocationSize(MoqAudioConsumer value) { + return 8; } -} -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), - ); - final announce = announce_lifted.value; - new_offset += announce_lifted.bytesRead; - return LiftRetVal(UpdateMoqAnnounceEvent._(announce), new_offset); + 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); } - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); + static int write(MoqAudioConsumer value, Uint8List buf) { + final handle = lower(value); + buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); + return 8; } +} - @override - int allocationSize() { - return FfiConverterMoqAnnounce.allocationSize(announce) + 4; +abstract class MoqAudioEncoderInterface { + MoqAudioPacket encode({required List pcm}); + MoqAudioEncoderFinish finish({required List pcm}); + int frameSize(); + void setBitrate({required int bitrate}); + MoqAudioInit trackInit(); +} + +final _MoqAudioEncoderFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_moq_ffi_fn_free_moqaudioencoder(ptr, status)); +}); + +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), + ); } - @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), + void dispose() { + if (_isDisposed) { + return; + } + _isDisposed = true; + _MoqAudioEncoderFinalizer.detach(this); + rustCall((status) => uniffi_moq_ffi_fn_free_moqaudioencoder(_ptr, status)); + } + + MoqAudioPacket encode({required List pcm}) { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqaudioencoder_encode( + uniffiClonePointer(), + FfiConverterSequenceDouble32.lower(pcm), + status, + ), + FfiConverterMoqAudioPacket.lift, + moqExceptionErrorHandler, ); - return new_offset; } -} -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), + MoqAudioEncoderFinish finish({required List pcm}) { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqaudioencoder_finish( + uniffiClonePointer(), + FfiConverterSequenceDouble32.lower(pcm), + status, + ), + FfiConverterMoqAudioEncoderFinish.lift, + moqExceptionErrorHandler, ); - final announce = announce_lifted.value; - new_offset += announce_lifted.bytesRead; - return LiftRetVal(EndMoqAnnounceEvent._(announce), new_offset); } - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); + int frameSize() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqaudioencoder_frame_size( + uniffiClonePointer(), + status, + ), + FfiConverterUInt64.lift, + moqExceptionErrorHandler, + ); } - @override - int allocationSize() { - return FfiConverterMoqAnnounce.allocationSize(announce) + 4; + void setBitrate({required int bitrate}) { + return rustCall((status) { + uniffi_moq_ffi_fn_method_moqaudioencoder_set_bitrate( + uniffiClonePointer(), + FfiConverterUInt64.lower(bitrate), + status, + ); + }, moqExceptionErrorHandler); } - @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), + MoqAudioInit trackInit() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqaudioencoder_track_init( + uniffiClonePointer(), + status, + ), + FfiConverterMoqAudioInit.lift, + moqExceptionErrorHandler, ); - return new_offset; } } -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); +class FfiConverterMoqAudioEncoder { + static MoqAudioEncoder lift(Pointer ptr) { + return MoqAudioEncoder.lift(ptr); } - @override - RustBuffer lower() { - final buf = Uint8List(allocationSize()); - write(buf); - return toRustBuffer(buf); + static Pointer lower(MoqAudioEncoder value) { + return value.uniffiClonePointer(); } - @override - int allocationSize() { - return FfiConverterMoqAnnounce.allocationSize(announce) + 4; + static int allocationSize(MoqAudioEncoder value) { + return 8; } - @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), - ); - return new_offset; + 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); + } + + static int write(MoqAudioEncoder value, Uint8List buf) { + final handle = lower(value); + buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); + return 8; } } -enum MoqTransport { quic, iroh, webSocket, tcp, unix, webTransport } +abstract class MoqAudioProducerInterface { + MoqTrackDemand demand(); + void finish(); + void reanchor(); + MoqReservation? reservation(); + void write({required MoqAudioFrame frame}); +} -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", - ); +final _MoqAudioProducerFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_moq_ffi_fn_free_moqaudioproducer(ptr, status)); +}); + +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); + } + 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), + ); } - static MoqTransport lift(RustBuffer buffer) { - return FfiConverterMoqTransport.read(buffer.asUint8List()).value; + void dispose() { + if (_isDisposed) { + return; + } + _isDisposed = true; + _MoqAudioProducerFinalizer.detach(this); + rustCall((status) => uniffi_moq_ffi_fn_free_moqaudioproducer(_ptr, status)); } - static RustBuffer lower(MoqTransport input) { - return toRustBuffer(createUint8ListFromInt(input.index + 1)); + MoqTrackDemand demand() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqaudioproducer_demand( + uniffiClonePointer(), + status, + ), + FfiConverterMoqTrackDemand.lift, + moqExceptionErrorHandler, + ); } - static int allocationSize(MoqTransport _value) { - return 4; + 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); + } + + MoqReservation? reservation() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqaudioproducer_reservation( + uniffiClonePointer(), + status, + ), + FfiConverterOptionalMoqReservation.lift, + null, + ); } - static int write(MoqTransport 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); } } -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 FfiConverterMoqAudioProducer { + static MoqAudioProducer lift(Pointer ptr) { + return MoqAudioProducer.lift(ptr); } - static MoqConnectionStatus lift(RustBuffer buffer) { - return FfiConverterMoqConnectionStatus.read(buffer.asUint8List()).value; + static Pointer lower(MoqAudioProducer value) { + return value.uniffiClonePointer(); } - static RustBuffer lower(MoqConnectionStatus input) { - return toRustBuffer(createUint8ListFromInt(input.index + 1)); + static int allocationSize(MoqAudioProducer 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(MoqAudioProducer.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(MoqAudioProducer value, Uint8List buf) { + final handle = lower(value); + buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); + return 8; } } @@ -8623,101 +10570,311 @@ class MoqGroupProducer implements MoqGroupProducerInterface { }, moqExceptionErrorHandler); } - MoqGroupConsumer consume() { - return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqgroupproducer_consume( - uniffiClonePointer(), - status, - ), - FfiConverterMoqGroupConsumer.lift, - moqExceptionErrorHandler, - ); + MoqGroupConsumer consume() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqgroupproducer_consume( + uniffiClonePointer(), + status, + ), + FfiConverterMoqGroupConsumer.lift, + moqExceptionErrorHandler, + ); + } + + void finish() { + return rustCall((status) { + uniffi_moq_ffi_fn_method_moqgroupproducer_finish( + uniffiClonePointer(), + 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 FfiConverterMoqGroupProducer { + static MoqGroupProducer lift(Pointer ptr) { + return MoqGroupProducer.lift(ptr); + } + + static Pointer lower(MoqGroupProducer value) { + return value.uniffiClonePointer(); + } + + static int allocationSize(MoqGroupProducer value) { + return 8; + } + + 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); + } + + static int write(MoqGroupProducer 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(); +} + +final _MoqGroupRequestFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_moq_ffi_fn_free_moqgrouprequest(ptr, status)); +}); + +class MoqGroupRequest implements MoqGroupRequestInterface { + late final Pointer _ptr; + bool _isDisposed = false; + MoqGroupRequest._(this._ptr) { + _MoqGroupRequestFinalizer.attach(this, _ptr, detach: this); + } + 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_moqgrouprequest(_ptr, status), + ); + } + + void dispose() { + if (_isDisposed) { + 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); + } + + MoqGroupProducer accept() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqgrouprequest_accept( + uniffiClonePointer(), + status, + ), + FfiConverterMoqGroupProducer.lift, + moqExceptionErrorHandler, + ); + } + + MoqGroupDemand demand() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqgrouprequest_demand( + uniffiClonePointer(), + status, + ), + FfiConverterMoqGroupDemand.lift, + moqExceptionErrorHandler, + ); + } + + int priority() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqgrouprequest_priority( + uniffiClonePointer(), + status, + ), + FfiConverterUInt8.lift, + null, + ); + } + + int sequence() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqgrouprequest_sequence( + uniffiClonePointer(), + status, + ), + FfiConverterUInt64.lift, + null, + ); + } +} + +class FfiConverterMoqGroupRequest { + static MoqGroupRequest lift(Pointer ptr) { + return MoqGroupRequest.lift(ptr); + } + + static Pointer lower(MoqGroupRequest value) { + return value.uniffiClonePointer(); + } + + static int allocationSize(MoqGroupRequest value) { + return 8; + } + + 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); + } + + static int write(MoqGroupRequest value, Uint8List buf) { + final handle = lower(value); + buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); + return 8; + } +} + +abstract class MoqTrackDynamicInterface { + void cancel(); + Future requestedGroup(); +} + +final _MoqTrackDynamicFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_moq_ffi_fn_free_moqtrackdynamic(ptr, status)); +}); + +class MoqTrackDynamic implements MoqTrackDynamicInterface { + late final Pointer _ptr; + bool _isDisposed = false; + MoqTrackDynamic._(this._ptr) { + _MoqTrackDynamicFinalizer.attach(this, _ptr, detach: this); + } + 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_moqtrackdynamic(_ptr, status), + ); + } + + void dispose() { + if (_isDisposed) { + return; + } + _isDisposed = true; + _MoqTrackDynamicFinalizer.detach(this); + rustCall((status) => uniffi_moq_ffi_fn_free_moqtrackdynamic(_ptr, status)); } - void finish() { + void cancel() { return rustCall((status) { - uniffi_moq_ffi_fn_method_moqgroupproducer_finish( + uniffi_moq_ffi_fn_method_moqtrackdynamic_cancel( uniffiClonePointer(), status, ); - }, moqExceptionErrorHandler); + }, null); } - int sequence() { - return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqgroupproducer_sequence( + Future requestedGroup() { + return uniffiRustCallAsync( + () => uniffi_moq_ffi_fn_method_moqtrackdynamic_requested_group( uniffiClonePointer(), - status, ), - FfiConverterUInt64.lift, - null, + 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)), + moqExceptionErrorHandler, ); } - - void writeFrame({required MoqFrame frame}) { - return rustCall((status) { - uniffi_moq_ffi_fn_method_moqgroupproducer_write_frame( - uniffiClonePointer(), - FfiConverterMoqFrame.lower(frame), - status, - ); - }, moqExceptionErrorHandler); - } } -class FfiConverterMoqGroupProducer { - static MoqGroupProducer lift(Pointer ptr) { - return MoqGroupProducer.lift(ptr); +class FfiConverterMoqTrackDynamic { + static MoqTrackDynamic lift(Pointer ptr) { + return MoqTrackDynamic.lift(ptr); } - static Pointer lower(MoqGroupProducer value) { + static Pointer lower(MoqTrackDynamic value) { return value.uniffiClonePointer(); } - static int allocationSize(MoqGroupProducer 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(MoqGroupProducer.lift(pointer), 8); + return LiftRetVal(MoqTrackDynamic.lift(pointer), 8); } - static int write(MoqGroupProducer 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 MoqGroupRequestInterface { +abstract class MoqTrackProducerInterface { void abort({required int errorCode}); - MoqGroupProducer accept(); - MoqGroupDemand demand(); - int priority(); - int sequence(); + 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 _MoqGroupRequestFinalizer = Finalizer>((ptr) { - rustCall((status) => uniffi_moq_ffi_fn_free_moqgrouprequest(ptr, status)); +final _MoqTrackProducerFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_moq_ffi_fn_free_moqtrackproducer(ptr, status)); }); -class MoqGroupRequest implements MoqGroupRequestInterface { +class MoqTrackProducer implements MoqTrackProducerInterface { late final Pointer _ptr; bool _isDisposed = false; - MoqGroupRequest._(this._ptr) { - _MoqGroupRequestFinalizer.attach(this, _ptr, detach: this); + MoqTrackProducer._(this._ptr) { + _MoqTrackProducerFinalizer.attach(this, _ptr, detach: this); } - factory MoqGroupRequest.lift(Pointer ptr) { - return MoqGroupRequest._(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_moqgrouprequest(_ptr, status), + (status) => uniffi_moq_ffi_fn_clone_moqtrackproducer(_ptr, status), ); } @@ -8726,13 +10883,13 @@ class MoqGroupRequest implements MoqGroupRequestInterface { return; } _isDisposed = true; - _MoqGroupRequestFinalizer.detach(this); - rustCall((status) => uniffi_moq_ffi_fn_free_moqgrouprequest(_ptr, status)); + _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_moqgrouprequest_abort( + uniffi_moq_ffi_fn_method_moqtrackproducer_abort( uniffiClonePointer(), FfiConverterUInt16.lower(errorCode), status, @@ -8740,9 +10897,21 @@ class MoqGroupRequest implements MoqGroupRequestInterface { }, moqExceptionErrorHandler); } - MoqGroupProducer accept() { + int appendDatagram({required MoqFrame frame}) { return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqgrouprequest_accept( + (status) => uniffi_moq_ffi_fn_method_moqtrackproducer_append_datagram( + uniffiClonePointer(), + FfiConverterMoqFrame.lower(frame), + status, + ), + FfiConverterUInt64.lift, + moqExceptionErrorHandler, + ); + } + + MoqGroupProducer appendGroup() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqtrackproducer_append_group( uniffiClonePointer(), status, ), @@ -8751,90 +10920,135 @@ class MoqGroupRequest implements MoqGroupRequestInterface { ); } - MoqGroupDemand demand() { + MoqTrackConsumer consume({required MoqSubscription? subscription}) { return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqgrouprequest_demand( + (status) => uniffi_moq_ffi_fn_method_moqtrackproducer_consume( uniffiClonePointer(), + FfiConverterOptionalMoqSubscription.lower(subscription), status, ), - FfiConverterMoqGroupDemand.lift, + FfiConverterMoqTrackConsumer.lift, moqExceptionErrorHandler, ); } - int priority() { + MoqGroupProducer createGroup({required int sequence}) { return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqgrouprequest_priority( + (status) => uniffi_moq_ffi_fn_method_moqtrackproducer_create_group( + uniffiClonePointer(), + FfiConverterUInt64.lower(sequence), + status, + ), + FfiConverterMoqGroupProducer.lift, + moqExceptionErrorHandler, + ); + } + + MoqTrackDemand demand() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqtrackproducer_demand( uniffiClonePointer(), status, ), - FfiConverterUInt8.lift, - null, + FfiConverterMoqTrackDemand.lift, + moqExceptionErrorHandler, ); } - int sequence() { + MoqTrackDynamic dynamic_() { return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqgrouprequest_sequence( + (status) => uniffi_moq_ffi_fn_method_moqtrackproducer_dynamic( uniffiClonePointer(), status, ), - FfiConverterUInt64.lift, - null, + 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 FfiConverterMoqGroupRequest { - static MoqGroupRequest lift(Pointer ptr) { - return MoqGroupRequest.lift(ptr); +class FfiConverterMoqTrackProducer { + static MoqTrackProducer lift(Pointer ptr) { + return MoqTrackProducer.lift(ptr); } - static Pointer lower(MoqGroupRequest value) { + static Pointer lower(MoqTrackProducer value) { return value.uniffiClonePointer(); } - static int allocationSize(MoqGroupRequest 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(MoqGroupRequest.lift(pointer), 8); + return LiftRetVal(MoqTrackProducer.lift(pointer), 8); } - static int write(MoqGroupRequest 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 MoqTrackDynamicInterface { - void cancel(); - Future requestedGroup(); +abstract class MoqTrackRequestInterface { + void abort({required int errorCode}); + MoqTrackProducer accept({required MoqTrackInfo? info}); + MoqTrackDemand demand(); + MoqTrackDynamic dynamic_(); + String name(); } -final _MoqTrackDynamicFinalizer = Finalizer>((ptr) { - rustCall((status) => uniffi_moq_ffi_fn_free_moqtrackdynamic(ptr, status)); +final _MoqTrackRequestFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_moq_ffi_fn_free_moqtrackrequest(ptr, status)); }); -class MoqTrackDynamic implements MoqTrackDynamicInterface { +class MoqTrackRequest implements MoqTrackRequestInterface { late final Pointer _ptr; bool _isDisposed = false; - MoqTrackDynamic._(this._ptr) { - _MoqTrackDynamicFinalizer.attach(this, _ptr, detach: this); + MoqTrackRequest._(this._ptr) { + _MoqTrackRequestFinalizer.attach(this, _ptr, detach: this); } - factory MoqTrackDynamic.lift(Pointer ptr) { - return MoqTrackDynamic._(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_moqtrackdynamic(_ptr, status), + (status) => uniffi_moq_ffi_fn_clone_moqtrackrequest(_ptr, status), ); } @@ -8843,91 +11057,124 @@ class MoqTrackDynamic implements MoqTrackDynamicInterface { return; } _isDisposed = true; - _MoqTrackDynamicFinalizer.detach(this); - rustCall((status) => uniffi_moq_ffi_fn_free_moqtrackdynamic(_ptr, status)); + _MoqTrackRequestFinalizer.detach(this); + rustCall((status) => uniffi_moq_ffi_fn_free_moqtrackrequest(_ptr, status)); + } + + void abort({required int errorCode}) { + return rustCall((status) { + uniffi_moq_ffi_fn_method_moqtrackrequest_abort( + 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, + ); } - void cancel() { - return rustCall((status) { - uniffi_moq_ffi_fn_method_moqtrackdynamic_cancel( + MoqTrackDynamic dynamic_() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqtrackrequest_dynamic( uniffiClonePointer(), status, - ); - }, null); + ), + FfiConverterMoqTrackDynamic.lift, + moqExceptionErrorHandler, + ); } - Future requestedGroup() { - return uniffiRustCallAsync( - () => uniffi_moq_ffi_fn_method_moqtrackdynamic_requested_group( + String name() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqtrackrequest_name( uniffiClonePointer(), + status, ), - 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)), + FfiConverterString.lift, moqExceptionErrorHandler, ); } } -class FfiConverterMoqTrackDynamic { - static MoqTrackDynamic lift(Pointer ptr) { - return MoqTrackDynamic.lift(ptr); +class FfiConverterMoqTrackRequest { + static MoqTrackRequest lift(Pointer ptr) { + return MoqTrackRequest.lift(ptr); } - static Pointer lower(MoqTrackDynamic value) { + static Pointer lower(MoqTrackRequest value) { return value.uniffiClonePointer(); } - static int allocationSize(MoqTrackDynamic 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(MoqTrackDynamic.lift(pointer), 8); + return LiftRetVal(MoqTrackRequest.lift(pointer), 8); } - static int write(MoqTrackDynamic 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 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 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 _MoqTrackProducerFinalizer = Finalizer>((ptr) { - rustCall((status) => uniffi_moq_ffi_fn_free_moqtrackproducer(ptr, status)); +final _MoqRequestFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_moq_ffi_fn_free_moqrequest(ptr, status)); }); -class MoqTrackProducer implements MoqTrackProducerInterface { +class MoqRequest implements MoqRequestInterface { late final Pointer _ptr; bool _isDisposed = false; - MoqTrackProducer._(this._ptr) { - _MoqTrackProducerFinalizer.attach(this, _ptr, detach: this); + MoqRequest._(this._ptr) { + _MoqRequestFinalizer.attach(this, _ptr, detach: this); } - factory MoqTrackProducer.lift(Pointer ptr) { - return MoqTrackProducer._(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_moqtrackproducer(_ptr, status), + (status) => uniffi_moq_ffi_fn_clone_moqrequest(_ptr, status), ); } @@ -8936,172 +11183,265 @@ 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); + _MoqRequestFinalizer.detach(this); + rustCall((status) => uniffi_moq_ffi_fn_free_moqrequest(_ptr, status)); } - int appendDatagram({required MoqFrame frame}) { - return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqtrackproducer_append_datagram( + Future accept({ + MoqOriginProducer? publish = null, + MoqOriginProducer? consume = null, + }) { + return uniffiRustCallAsync( + () => uniffi_moq_ffi_fn_method_moqrequest_accept( uniffiClonePointer(), - FfiConverterMoqFrame.lower(frame), - status, + FfiConverterOptionalMoqOriginProducer.lower(publish), + FfiConverterOptionalMoqOriginProducer.lower(consume), ), - FfiConverterUInt64.lift, + 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, ); } - MoqGroupProducer appendGroup() { + void cancel() { + return rustCall((status) { + uniffi_moq_ffi_fn_method_moqrequest_cancel(uniffiClonePointer(), status); + }, null); + } + + String path() { return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqtrackproducer_append_group( + (status) => uniffi_moq_ffi_fn_method_moqrequest_path( uniffiClonePointer(), status, ), - FfiConverterMoqGroupProducer.lift, - moqExceptionErrorHandler, + FfiConverterString.lift, + null, ); } - MoqTrackConsumer consume({required MoqSubscription? subscription}) { + String? query() { return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqtrackproducer_consume( + (status) => uniffi_moq_ffi_fn_method_moqrequest_query( uniffiClonePointer(), - FfiConverterOptionalMoqSubscription.lower(subscription), status, ), - FfiConverterMoqTrackConsumer.lift, - moqExceptionErrorHandler, + FfiConverterOptionalString.lift, + null, ); } - MoqGroupProducer createGroup({required int sequence}) { - return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqtrackproducer_create_group( + Future reject({required int code}) { + return uniffiRustCallAsync( + () => uniffi_moq_ffi_fn_method_moqrequest_reject( uniffiClonePointer(), - FfiConverterUInt64.lower(sequence), - status, + FfiConverterUInt16.lower(code), ), - FfiConverterMoqGroupProducer.lift, + ffi_moq_ffi_rust_future_poll_void, + ffi_moq_ffi_rust_future_complete_void, + ffi_moq_ffi_rust_future_free_void, + (_) {}, moqExceptionErrorHandler, ); } - MoqTrackDemand demand() { + MoqTransport transport() { return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqtrackproducer_demand( + (status) => uniffi_moq_ffi_fn_method_moqrequest_transport( uniffiClonePointer(), status, ), - FfiConverterMoqTrackDemand.lift, - moqExceptionErrorHandler, + FfiConverterMoqTransport.lift, + null, ); } - MoqTrackDynamic dynamic_() { + String? url() { return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqtrackproducer_dynamic( - uniffiClonePointer(), - status, - ), - FfiConverterMoqTrackDynamic.lift, - moqExceptionErrorHandler, + (status) => + uniffi_moq_ffi_fn_method_moqrequest_url(uniffiClonePointer(), status), + FfiConverterOptionalString.lift, + null, ); } +} - void finish() { - return rustCall((status) { - uniffi_moq_ffi_fn_method_moqtrackproducer_finish( - uniffiClonePointer(), - status, - ); - }, moqExceptionErrorHandler); +class FfiConverterMoqRequest { + static MoqRequest lift(Pointer ptr) { + return MoqRequest.lift(ptr); + } + + static Pointer lower(MoqRequest value) { + return value.uniffiClonePointer(); + } + + static int allocationSize(MoqRequest value) { + return 8; + } + + 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); + } + + static int write(MoqRequest 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(); +} + +final _MoqServerFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_moq_ffi_fn_free_moqserver(ptr, status)); +}); + +class MoqServer implements MoqServerInterface { + late final Pointer _ptr; + bool _isDisposed = false; + MoqServer._(this._ptr) { + _MoqServerFinalizer.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); + } + 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_moqserver(_ptr, status), + ); + } + + void dispose() { + if (_isDisposed) { + 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, + ); } - void finishAt({required int finalSequence}) { + void cancel() { return rustCall((status) { - uniffi_moq_ffi_fn_method_moqtrackproducer_finish_at( - uniffiClonePointer(), - FfiConverterUInt64.lower(finalSequence), - status, - ); - }, moqExceptionErrorHandler); + uniffi_moq_ffi_fn_method_moqserver_cancel(uniffiClonePointer(), status); + }, null); } - void writeFrame({required MoqFrame frame}) { - return rustCall((status) { - uniffi_moq_ffi_fn_method_moqtrackproducer_write_frame( + List certFingerprints() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqserver_cert_fingerprints( uniffiClonePointer(), - FfiConverterMoqFrame.lower(frame), status, - ); - }, moqExceptionErrorHandler); + ), + FfiConverterSequenceString.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, + moqExceptionErrorHandler, + ); } } -class FfiConverterMoqTrackProducer { - static MoqTrackProducer lift(Pointer ptr) { - return MoqTrackProducer.lift(ptr); +class FfiConverterMoqServer { + static MoqServer lift(Pointer ptr) { + return MoqServer.lift(ptr); } - static Pointer lower(MoqTrackProducer value) { + static Pointer lower(MoqServer value) { return value.uniffiClonePointer(); } - static int allocationSize(MoqTrackProducer 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(MoqTrackProducer.lift(pointer), 8); + return LiftRetVal(MoqServer.lift(pointer), 8); } - static int write(MoqTrackProducer 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 MoqTrackRequestInterface { - void abort({required int errorCode}); - MoqTrackProducer accept({required MoqTrackInfo? info}); - MoqTrackDemand demand(); - MoqTrackDynamic dynamic_(); - String name(); +abstract class MoqClientInterface { + void cancel(); + Future connect({required String url}); } -final _MoqTrackRequestFinalizer = Finalizer>((ptr) { - rustCall((status) => uniffi_moq_ffi_fn_free_moqtrackrequest(ptr, status)); +final _MoqClientFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_moq_ffi_fn_free_moqclient(ptr, status)); }); -class MoqTrackRequest implements MoqTrackRequestInterface { +class MoqClient implements MoqClientInterface { late final Pointer _ptr; bool _isDisposed = false; - MoqTrackRequest._(this._ptr) { - _MoqTrackRequestFinalizer.attach(this, _ptr, detach: this); + MoqClient._(this._ptr) { + _MoqClientFinalizer.attach(this, _ptr, detach: this); } - factory MoqTrackRequest.lift(Pointer ptr) { - return MoqTrackRequest._(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_moqtrackrequest(_ptr, status), + (status) => uniffi_moq_ffi_fn_clone_moqclient(_ptr, status), ); } @@ -9110,124 +11450,88 @@ class MoqTrackRequest implements MoqTrackRequestInterface { return; } _isDisposed = true; - _MoqTrackRequestFinalizer.detach(this); - rustCall((status) => uniffi_moq_ffi_fn_free_moqtrackrequest(_ptr, status)); + _MoqClientFinalizer.detach(this); + rustCall((status) => uniffi_moq_ffi_fn_free_moqclient(_ptr, status)); } - void abort({required int errorCode}) { + void cancel() { return rustCall((status) { - uniffi_moq_ffi_fn_method_moqtrackrequest_abort( - 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, - ); + uniffi_moq_ffi_fn_method_moqclient_cancel(uniffiClonePointer(), status); + }, null); } - String name() { - return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqtrackrequest_name( + Future connect({required String url}) { + return uniffiRustCallAsync( + () => uniffi_moq_ffi_fn_method_moqclient_connect( uniffiClonePointer(), - status, + FfiConverterString.lower(url), ), - FfiConverterString.lift, + 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, ); } } -class FfiConverterMoqTrackRequest { - static MoqTrackRequest lift(Pointer ptr) { - return MoqTrackRequest.lift(ptr); +class FfiConverterMoqClient { + static MoqClient lift(Pointer ptr) { + return MoqClient.lift(ptr); } - static Pointer lower(MoqTrackRequest value) { + static Pointer lower(MoqClient value) { return value.uniffiClonePointer(); } - static int allocationSize(MoqTrackRequest 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(MoqTrackRequest.lift(pointer), 8); + return LiftRetVal(MoqClient.lift(pointer), 8); } - static int write(MoqTrackRequest 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 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 MoqSessionInterface { + MoqBandwidth bandwidth(); + void cancel({required int code}); + Future closed(); + int connects(); + MoqOriginConsumer consume(); + MoqOriginProducer publish(); + Future shutdown(); + MoqConnectionStats stats(); + Future status(); } -final _MoqRequestFinalizer = Finalizer>((ptr) { - rustCall((status) => uniffi_moq_ffi_fn_free_moqrequest(ptr, status)); +final _MoqSessionFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_moq_ffi_fn_free_moqsession(ptr, status)); }); -class MoqRequest implements MoqRequestInterface { +class MoqSession implements MoqSessionInterface { late final Pointer _ptr; bool _isDisposed = false; - MoqRequest._(this._ptr) { - _MoqRequestFinalizer.attach(this, _ptr, detach: this); + MoqSession._(this._ptr) { + _MoqSessionFinalizer.attach(this, _ptr, detach: this); } - factory MoqRequest.lift(Pointer ptr) { - return MoqRequest._(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_moqrequest(_ptr, status), + (status) => uniffi_moq_ffi_fn_clone_moqsession(_ptr, status), ); } @@ -9236,62 +11540,78 @@ class MoqRequest implements MoqRequestInterface { return; } _isDisposed = true; - _MoqRequestFinalizer.detach(this); - rustCall((status) => uniffi_moq_ffi_fn_free_moqrequest(_ptr, status)); + _MoqSessionFinalizer.detach(this); + rustCall((status) => uniffi_moq_ffi_fn_free_moqsession(_ptr, status)); } - Future accept({ - MoqOriginProducer? publish = null, - MoqOriginProducer? consume = null, - }) { - return uniffiRustCallAsync( - () => uniffi_moq_ffi_fn_method_moqrequest_accept( + MoqBandwidth bandwidth() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqsession_bandwidth( uniffiClonePointer(), - FfiConverterOptionalMoqOriginProducer.lower(publish), - FfiConverterOptionalMoqOriginProducer.lower(consume), + status, ), - 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, + FfiConverterMoqBandwidth.lift, + null, ); } - void cancel() { + void cancel({required int code}) { return rustCall((status) { - uniffi_moq_ffi_fn_method_moqrequest_cancel(uniffiClonePointer(), status); + uniffi_moq_ffi_fn_method_moqsession_cancel( + uniffiClonePointer(), + FfiConverterUInt32.lower(code), + status, + ); }, null); } - String path() { + 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, + ); + } + + int connects() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqsession_connects( + uniffiClonePointer(), + status, + ), + FfiConverterUInt64.lift, + null, + ); + } + + MoqOriginConsumer consume() { return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqrequest_path( + (status) => uniffi_moq_ffi_fn_method_moqsession_consume( uniffiClonePointer(), status, ), - FfiConverterString.lift, + FfiConverterMoqOriginConsumer.lift, null, ); } - String? query() { + MoqOriginProducer publish() { return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqrequest_query( + (status) => uniffi_moq_ffi_fn_method_moqsession_publish( uniffiClonePointer(), status, ), - FfiConverterOptionalString.lift, + FfiConverterMoqOriginProducer.lift, null, ); } - Future reject({required int code}) { + Future shutdown() { return uniffiRustCallAsync( - () => uniffi_moq_ffi_fn_method_moqrequest_reject( - uniffiClonePointer(), - FfiConverterUInt16.lower(code), - ), + () => 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, @@ -9300,89 +11620,100 @@ class MoqRequest implements MoqRequestInterface { ); } - MoqTransport transport() { + MoqConnectionStats stats() { return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqrequest_transport( + (status) => uniffi_moq_ffi_fn_method_moqsession_stats( uniffiClonePointer(), status, ), - FfiConverterMoqTransport.lift, + FfiConverterMoqConnectionStats.lift, null, ); } - String? url() { - return rustCallWithLifter( - (status) => - uniffi_moq_ffi_fn_method_moqrequest_url(uniffiClonePointer(), status), - FfiConverterOptionalString.lift, - null, + 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 FfiConverterMoqRequest { - static MoqRequest lift(Pointer ptr) { - return MoqRequest.lift(ptr); +class FfiConverterMoqSession { + static MoqSession lift(Pointer ptr) { + return MoqSession.lift(ptr); } - static Pointer lower(MoqRequest value) { + static Pointer lower(MoqSession value) { return value.uniffiClonePointer(); } - static int allocationSize(MoqRequest 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(MoqRequest.lift(pointer), 8); + return LiftRetVal(MoqSession.lift(pointer), 8); } - static int write(MoqRequest 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 MoqServerInterface { - Future accept(); +abstract class MoqVideoConsumerInterface { void cancel(); - List certFingerprints(); - Future listen(); + Future next(); } -final _MoqServerFinalizer = Finalizer>((ptr) { - rustCall((status) => uniffi_moq_ffi_fn_free_moqserver(ptr, status)); +final _MoqVideoConsumerFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_moq_ffi_fn_free_moqvideoconsumer(ptr, status)); }); -class MoqServer implements MoqServerInterface { +class MoqVideoConsumer implements MoqVideoConsumerInterface { late final Pointer _ptr; bool _isDisposed = false; - MoqServer._(this._ptr) { - _MoqServerFinalizer.attach(this, _ptr, detach: this); + MoqVideoConsumer._(this._ptr) { + _MoqVideoConsumerFinalizer.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); + 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 MoqServer.lift(Pointer ptr) { - return MoqServer._(ptr); + + 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_moqserver(_ptr, status), + (status) => uniffi_moq_ffi_fn_clone_moqvideoconsumer(_ptr, status), ); } @@ -9391,110 +11722,224 @@ class MoqServer implements MoqServerInterface { return; } _isDisposed = true; - _MoqServerFinalizer.detach(this); - rustCall((status) => uniffi_moq_ffi_fn_free_moqserver(_ptr, status)); + _MoqVideoConsumerFinalizer.detach(this); + rustCall((status) => uniffi_moq_ffi_fn_free_moqvideoconsumer(_ptr, status)); } - Future accept() { + void cancel() { + return rustCall((status) { + uniffi_moq_ffi_fn_method_moqvideoconsumer_cancel( + uniffiClonePointer(), + status, + ); + }, null); + } + + Future next() { return uniffiRustCallAsync( - () => uniffi_moq_ffi_fn_method_moqserver_accept(uniffiClonePointer()), + () => + 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, - FfiConverterOptionalMoqRequest.lift, + FfiConverterOptionalMoqVideoDecodedFrame.lift, moqExceptionErrorHandler, ); } +} - void cancel() { - return rustCall((status) { - uniffi_moq_ffi_fn_method_moqserver_cancel(uniffiClonePointer(), status); - }, null); +class FfiConverterMoqVideoConsumer { + static MoqVideoConsumer lift(Pointer ptr) { + return MoqVideoConsumer.lift(ptr); } - List certFingerprints() { + static Pointer lower(MoqVideoConsumer value) { + return value.uniffiClonePointer(); + } + + static int allocationSize(MoqVideoConsumer value) { + return 8; + } + + static LiftRetVal read(Uint8List buf) { + final handle = buf.buffer.asByteData(buf.offsetInBytes).getInt64(0); + final pointer = Pointer.fromAddress(handle); + return LiftRetVal(MoqVideoConsumer.lift(pointer), 8); + } + + static int write(MoqVideoConsumer value, Uint8List buf) { + final handle = lower(value); + buf.buffer.asByteData(buf.offsetInBytes).setInt64(0, handle.address); + return 8; + } +} + +abstract class MoqVideoDecodedFrameInterface { + int height(); + Uint8List pixels({required MoqVideoPixelFormat format}); + MoqVideoSurface? surface(); + int timestampUs(); + int width(); +} + +final _MoqVideoDecodedFrameFinalizer = Finalizer>((ptr) { + rustCall( + (status) => uniffi_moq_ffi_fn_free_moqvideodecodedframe(ptr, status), + ); +}); + +class MoqVideoDecodedFrame implements MoqVideoDecodedFrameInterface { + late final Pointer _ptr; + bool _isDisposed = false; + MoqVideoDecodedFrame._(this._ptr) { + _MoqVideoDecodedFrameFinalizer.attach(this, _ptr, detach: this); + } + 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_moqvideodecodedframe(_ptr, status), + ); + } + + void dispose() { + if (_isDisposed) { + return; + } + _isDisposed = true; + _MoqVideoDecodedFrameFinalizer.detach(this); + rustCall( + (status) => uniffi_moq_ffi_fn_free_moqvideodecodedframe(_ptr, status), + ); + } + + int height() { return rustCallWithLifter( - (status) => uniffi_moq_ffi_fn_method_moqserver_cert_fingerprints( + (status) => uniffi_moq_ffi_fn_method_moqvideodecodedframe_height( uniffiClonePointer(), status, ), - FfiConverterSequenceString.lift, - moqExceptionErrorHandler, + FfiConverterUInt32.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, + Uint8List pixels({required MoqVideoPixelFormat format}) { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqvideodecodedframe_pixels( + uniffiClonePointer(), + FfiConverterMoqVideoPixelFormat.lower(format), + status, + ), + FfiConverterUint8List.lift, moqExceptionErrorHandler, ); } + + MoqVideoSurface? surface() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqvideodecodedframe_surface( + uniffiClonePointer(), + status, + ), + FfiConverterOptionalMoqVideoSurface.lift, + null, + ); + } + + int timestampUs() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqvideodecodedframe_timestamp_us( + uniffiClonePointer(), + status, + ), + FfiConverterUInt64.lift, + null, + ); + } + + int width() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqvideodecodedframe_width( + uniffiClonePointer(), + status, + ), + FfiConverterUInt32.lift, + null, + ); + } } -class FfiConverterMoqServer { - static MoqServer lift(Pointer ptr) { - return MoqServer.lift(ptr); +class FfiConverterMoqVideoDecodedFrame { + static MoqVideoDecodedFrame lift(Pointer ptr) { + return MoqVideoDecodedFrame.lift(ptr); } - static Pointer lower(MoqServer value) { + static Pointer lower(MoqVideoDecodedFrame value) { return value.uniffiClonePointer(); } - static int allocationSize(MoqServer 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(MoqServer.lift(pointer), 8); + return LiftRetVal(MoqVideoDecodedFrame.lift(pointer), 8); } - static int write(MoqServer 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 MoqClientInterface { - void cancel(); - Future connect({required String url}); +abstract class MoqVideoEncoderInterface { + void cut(); + List encode({required MoqVideoFrame frame}); + List finish(); + List flush(); + void setBitrate({required int bitrate}); } -final _MoqClientFinalizer = Finalizer>((ptr) { - rustCall((status) => uniffi_moq_ffi_fn_free_moqclient(ptr, status)); +final _MoqVideoEncoderFinalizer = Finalizer>((ptr) { + rustCall((status) => uniffi_moq_ffi_fn_free_moqvideoencoder(ptr, status)); }); -class MoqClient implements MoqClientInterface { +class MoqVideoEncoder implements MoqVideoEncoderInterface { late final Pointer _ptr; bool _isDisposed = false; - MoqClient._(this._ptr) { - _MoqClientFinalizer.attach(this, _ptr, detach: this); + MoqVideoEncoder._(this._ptr) { + _MoqVideoEncoderFinalizer.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); + 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 MoqClient.lift(Pointer ptr) { - return MoqClient._(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_moqclient(_ptr, status), + (status) => uniffi_moq_ffi_fn_clone_moqvideoencoder(_ptr, status), ); } @@ -9503,88 +11948,135 @@ class MoqClient implements MoqClientInterface { return; } _isDisposed = true; - _MoqClientFinalizer.detach(this); - rustCall((status) => uniffi_moq_ffi_fn_free_moqclient(_ptr, status)); + _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_moqclient_cancel(uniffiClonePointer(), status); - }, null); + uniffi_moq_ffi_fn_method_moqvideoencoder_cut( + uniffiClonePointer(), + status, + ); + }, moqExceptionErrorHandler); } - Future connect({required String url}) { - return uniffiRustCallAsync( - () => uniffi_moq_ffi_fn_method_moqclient_connect( + List encode({required MoqVideoFrame frame}) { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqvideoencoder_encode( uniffiClonePointer(), - FfiConverterString.lower(url), + FfiConverterMoqVideoFrame.lower(frame), + status, + ), + FfiConverterSequenceMoqVideoPacket.lift, + moqExceptionErrorHandler, + ); + } + + List finish() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqvideoencoder_finish( + uniffiClonePointer(), + status, + ), + FfiConverterSequenceMoqVideoPacket.lift, + moqExceptionErrorHandler, + ); + } + + List flush() { + return rustCallWithLifter( + (status) => uniffi_moq_ffi_fn_method_moqvideoencoder_flush( + uniffiClonePointer(), + status, ), - 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)), + FfiConverterSequenceMoqVideoPacket.lift, moqExceptionErrorHandler, ); } + + void setBitrate({required int bitrate}) { + return rustCall((status) { + uniffi_moq_ffi_fn_method_moqvideoencoder_set_bitrate( + uniffiClonePointer(), + 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 +12085,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 +12203,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) { @@ -10062,6 +12536,147 @@ class FfiConverterOptionalMoqAnnounceEvent { } } +class FfiConverterOptionalMoqAudioFrame { + static MoqAudioFrame? lift(RustBuffer buf) { + return FfiConverterOptionalMoqAudioFrame.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 = FfiConverterMoqAudioFrame.read( + Uint8List.view(buf.buffer, buf.offsetInBytes + 1), + ); + return LiftRetVal(result.value, result.bytesRead + 1); + } + + static int allocationSize([MoqAudioFrame? value]) { + if (value == null) { + return 1; + } + return FfiConverterMoqAudioFrame.allocationSize(value) + 1; + } + + static RustBuffer lower(MoqAudioFrame? value) { + if (value == null) { + return toRustBuffer(Uint8List.fromList([0])); + } + final buf = Uint8List( + FfiConverterOptionalMoqAudioFrame.allocationSize(value), + ); + FfiConverterOptionalMoqAudioFrame.write(value, buf); + return toRustBuffer(buf); + } + + static int write(MoqAudioFrame? value, Uint8List buf) { + if (value == null) { + buf[0] = 0; + return 1; + } + buf[0] = 1; + return FfiConverterMoqAudioFrame.write( + value, + Uint8List.view(buf.buffer, buf.offsetInBytes + 1), + ) + + 1; + } +} + +class FfiConverterOptionalMoqAudioPreset { + static MoqAudioPreset? lift(RustBuffer buf) { + return FfiConverterOptionalMoqAudioPreset.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 = FfiConverterMoqAudioPreset.read( + Uint8List.view(buf.buffer, buf.offsetInBytes + 1), + ); + return LiftRetVal(result.value, result.bytesRead + 1); + } + + static int allocationSize([MoqAudioPreset? value]) { + if (value == null) { + return 1; + } + return FfiConverterMoqAudioPreset.allocationSize(value) + 1; + } + + static RustBuffer lower(MoqAudioPreset? value) { + if (value == null) { + return toRustBuffer(Uint8List.fromList([0])); + } + final buf = Uint8List( + FfiConverterOptionalMoqAudioPreset.allocationSize(value), + ); + FfiConverterOptionalMoqAudioPreset.write(value, buf); + return toRustBuffer(buf); + } + + static int write(MoqAudioPreset? value, Uint8List buf) { + if (value == null) { + buf[0] = 0; + return 1; + } + buf[0] = 1; + return FfiConverterMoqAudioPreset.write( + value, + Uint8List.view(buf.buffer, buf.offsetInBytes + 1), + ) + + 1; + } +} + +class FfiConverterOptionalMoqBandwidth { + static MoqBandwidth? lift(RustBuffer buf) { + return FfiConverterOptionalMoqBandwidth.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 = FfiConverterMoqBandwidth.read( + Uint8List.view(buf.buffer, buf.offsetInBytes + 1), + ); + return LiftRetVal(result.value, result.bytesRead + 1); + } + + static int allocationSize([MoqBandwidth? value]) { + if (value == null) { + return 1; + } + return FfiConverterMoqBandwidth.allocationSize(value) + 1; + } + + static RustBuffer lower(MoqBandwidth? value) { + if (value == null) { + return toRustBuffer(Uint8List.fromList([0])); + } + final buf = Uint8List( + FfiConverterOptionalMoqBandwidth.allocationSize(value), + ); + FfiConverterOptionalMoqBandwidth.write(value, buf); + return toRustBuffer(buf); + } + + static int write(MoqBandwidth? value, Uint8List buf) { + if (value == null) { + buf[0] = 0; + return 1; + } + buf[0] = 1; + return FfiConverterMoqBandwidth.write( + value, + Uint8List.view(buf.buffer, buf.offsetInBytes + 1), + ) + + 1; + } +} + class FfiConverterOptionalMoqCatalog { static MoqCatalog? lift(RustBuffer buf) { return FfiConverterOptionalMoqCatalog.read(buf.asUint8List()).value; @@ -10531,6 +13146,53 @@ class FfiConverterOptionalMoqRequest { } } +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 = FfiConverterMoqReservation.read( + Uint8List.view(buf.buffer, buf.offsetInBytes + 1), + ); + return LiftRetVal(result.value, result.bytesRead + 1); + } + + static int allocationSize([MoqReservation? value]) { + if (value == null) { + return 1; + } + return FfiConverterMoqReservation.allocationSize(value) + 1; + } + + static RustBuffer lower(MoqReservation? value) { + if (value == null) { + return toRustBuffer(Uint8List.fromList([0])); + } + final buf = Uint8List( + FfiConverterOptionalMoqReservation.allocationSize(value), + ); + FfiConverterOptionalMoqReservation.write(value, buf); + return toRustBuffer(buf); + } + + static int write(MoqReservation? value, Uint8List buf) { + if (value == null) { + buf[0] = 0; + return 1; + } + buf[0] = 1; + return FfiConverterMoqReservation.write( + value, + Uint8List.view(buf.buffer, buf.offsetInBytes + 1), + ) + + 1; + } +} + class FfiConverterOptionalMoqSubscription { static MoqSubscription? lift(RustBuffer buf) { return FfiConverterOptionalMoqSubscription.read(buf.asUint8List()).value; @@ -10625,6 +13287,105 @@ class FfiConverterOptionalMoqTrackInfo { } } +class FfiConverterOptionalMoqVideoDecodedFrame { + static MoqVideoDecodedFrame? lift(RustBuffer buf) { + return FfiConverterOptionalMoqVideoDecodedFrame.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 = FfiConverterMoqVideoDecodedFrame.read( + Uint8List.view(buf.buffer, buf.offsetInBytes + 1), + ); + return LiftRetVal( + result.value, + result.bytesRead + 1, + ); + } + + static int allocationSize([MoqVideoDecodedFrame? value]) { + if (value == null) { + return 1; + } + return FfiConverterMoqVideoDecodedFrame.allocationSize(value) + 1; + } + + static RustBuffer lower(MoqVideoDecodedFrame? value) { + if (value == null) { + return toRustBuffer(Uint8List.fromList([0])); + } + final buf = Uint8List( + FfiConverterOptionalMoqVideoDecodedFrame.allocationSize(value), + ); + FfiConverterOptionalMoqVideoDecodedFrame.write(value, buf); + return toRustBuffer(buf); + } + + static int write(MoqVideoDecodedFrame? value, Uint8List buf) { + if (value == null) { + buf[0] = 0; + return 1; + } + buf[0] = 1; + return FfiConverterMoqVideoDecodedFrame.write( + value, + Uint8List.view(buf.buffer, buf.offsetInBytes + 1), + ) + + 1; + } +} + +class FfiConverterOptionalMoqVideoGop { + static MoqVideoGop? lift(RustBuffer buf) { + return FfiConverterOptionalMoqVideoGop.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 = FfiConverterMoqVideoGop.read( + Uint8List.view(buf.buffer, buf.offsetInBytes + 1), + ); + return LiftRetVal(result.value, result.bytesRead + 1); + } + + static int allocationSize([MoqVideoGop? value]) { + if (value == null) { + return 1; + } + return FfiConverterMoqVideoGop.allocationSize(value) + 1; + } + + static RustBuffer lower(MoqVideoGop? value) { + if (value == null) { + return toRustBuffer(Uint8List.fromList([0])); + } + final buf = Uint8List( + FfiConverterOptionalMoqVideoGop.allocationSize(value), + ); + FfiConverterOptionalMoqVideoGop.write(value, buf); + return toRustBuffer(buf); + } + + static int write(MoqVideoGop? value, Uint8List buf) { + if (value == null) { + buf[0] = 0; + return 1; + } + buf[0] = 1; + return FfiConverterMoqVideoGop.write( + value, + Uint8List.view(buf.buffer, buf.offsetInBytes + 1), + ) + + 1; + } +} + class FfiConverterOptionalMoqVideoHint { static MoqVideoHint? lift(RustBuffer buf) { return FfiConverterOptionalMoqVideoHint.read(buf.asUint8List()).value; @@ -10672,6 +13433,53 @@ class FfiConverterOptionalMoqVideoHint { } } +class FfiConverterOptionalMoqVideoSurface { + static MoqVideoSurface? lift(RustBuffer buf) { + return FfiConverterOptionalMoqVideoSurface.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 = FfiConverterMoqVideoSurface.read( + Uint8List.view(buf.buffer, buf.offsetInBytes + 1), + ); + return LiftRetVal(result.value, result.bytesRead + 1); + } + + static int allocationSize([MoqVideoSurface? value]) { + if (value == null) { + return 1; + } + return FfiConverterMoqVideoSurface.allocationSize(value) + 1; + } + + static RustBuffer lower(MoqVideoSurface? value) { + if (value == null) { + return toRustBuffer(Uint8List.fromList([0])); + } + final buf = Uint8List( + FfiConverterOptionalMoqVideoSurface.allocationSize(value), + ); + FfiConverterOptionalMoqVideoSurface.write(value, buf); + return toRustBuffer(buf); + } + + static int write(MoqVideoSurface? value, Uint8List buf) { + if (value == null) { + buf[0] = 0; + return 1; + } + buf[0] = 1; + return FfiConverterMoqVideoSurface.write( + value, + Uint8List.view(buf.buffer, buf.offsetInBytes + 1), + ) + + 1; + } +} + class FfiConverterOptionalSequenceString { static List? lift(RustBuffer buf) { return FfiConverterOptionalSequenceString.read(buf.asUint8List()).value; @@ -10840,62 +13648,195 @@ class FfiConverterOptionalUInt64 { 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; + 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 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 +14042,259 @@ 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, 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, +); + +@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, @@ -12935,49 +16094,265 @@ 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_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_moqvideodecodedframe( + Pointer handle, + Pointer uniffiStatus, +); + +@Native, Pointer)>( + assetId: _uniffiAssetId, +) +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 +16360,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 +16460,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 +16861,45 @@ 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_delay_us(); + +@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 +17329,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 +17466,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 +17498,45 @@ 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_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"); + } + 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 +17984,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 +18133,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 26f21788294..43616ceb97b 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, + id: '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/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 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*"]); });