create static method

Broadcast create({
  1. required int id,
  2. required Media media,
  3. required BroadcastConfiguration configuration,
})

Creates a new Broadcast instance.

Implementation

static Broadcast create(
    {required int id,
    required Media media,
    required BroadcastConfiguration configuration}) {
  Broadcast broadcast = new _Broadcast();
  broadcast.id = id;
  broadcast.media = media;
  broadcast.configuration = configuration;
  final args = [
    id,
    media.mediaType.toString().toNativeUtf8(),
    media.resource.toNativeUtf8(),
    configuration.access.toNativeUtf8(),
    configuration.mux.toNativeUtf8(),
    configuration.dst.toNativeUtf8(),
    configuration.vcodec.toNativeUtf8(),
    configuration.vb,
    configuration.acodec.toNativeUtf8(),
    configuration.ab
  ];
  BroadcastFFI.create(
    args[0] as int,
    args[1] as Pointer<Utf8>,
    args[2] as Pointer<Utf8>,
    args[3] as Pointer<Utf8>,
    args[4] as Pointer<Utf8>,
    args[5] as Pointer<Utf8>,
    args[6] as Pointer<Utf8>,
    args[7] as int,
    args[8] as Pointer<Utf8>,
    args[9] as int,
  );
  args.forEach((element) {
    if (element is Pointer<Utf8>) {
      calloc.free(element);
    }
  });
  return broadcast;
}